Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. net ads user info USERNAME@DOMAIN.COM -S DC_SERVER_NAME -U USERNAME
  2.  
  3. ads_pull_uint32 failed
  4.  
  5. #!/bin/bash
  6. # author: Tim Wahrendorff 2016
  7. # licence: Public Domain - https://wiki.creativecommons.org/wiki/Public_domain
  8. #
  9. # To use this script you need at least:
  10. # sudo apt-get install libnotify-bin rpcclient
  11. #
  12. # Please set your account, password and domaincontroller to use this script
  13.  
  14.  
  15. USER="username" # Domain accountname
  16. PASS="Pa$$W0rd" # Domain password
  17. DC="vmdc01" # Domaincontroller
  18.  
  19. ### START RPCCLIENT query
  20. if [ "x$USERDCID" == "x" ]; then
  21. RPCLOOKUPID=$(rpcclient -U $USER%$PASS -c "lookupnames $USER" $DC 2> ./rpc_errFile)
  22.  
  23. USERDCID=$(echo "$RPCLOOKUPID" | grep -e '[0-9]{4,9} ' -o)
  24. fi
  25.  
  26. QUERYUSER=$(rpcclient -U $USER%$PASS -c "queryuser $USERDCID" $DC 2> ./rpc_errFile)
  27.  
  28. EXPDATE=$(echo "$QUERYUSER" | grep 'Password must change Time' | grep -e '[a-Z]{2}, [0-9]{2} [a-Z]{3} [0-9]{4} [0-9]{2}:[0-9]{2}' -o)
  29.  
  30. ## Load rpc error Message
  31. RPCERR=$(<./rpc_errFile)
  32.  
  33. ## send notifications to Unity Desktop
  34. if [ "x$RPCERR" != "x" ]; then
  35. notify-send -i /usr/share/icons/gnome/48x48/status/dialog-error.png "Error while fetching expiration date of your domain password" "$RPCERR"
  36. else
  37. notify-send -i /usr/share/icons/gnome/48x48/status/dialog-information.png "your domain password expires at " "$EXPDATE h"
  38. fi
  39.  
  40. ### END RPCCLIENT query
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement