Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. ### Resetting Users Password using dsquesry from a CSV
  2.  
  3. ##### CSV Requirements #####
  4. ### First column need to be the name of the object in the OU, second column has to be the new Pass to set.
  5.  
  6.  
  7. # Paramaters to edit:
  8. param(
  9. $path = "C:\Users\roni\Desktop\123.csv",
  10. $DClocation = "OU=Fervital,OU=Hosting,DC=exsitu-testdc,DC=com"
  11. )
  12.  
  13.  
  14. # Loading the CSV file
  15. $HenUserList = get-content -Path $path
  16.  
  17. # Looping through the users and setting their new passwords
  18. for ($i=0;$i -lt $HenUserList.count;$i++){
  19.  
  20. $UserName = ($HenUserList[$i] -split (","))[0]
  21. $UserNewPass = ($HenUserList[$i] -split (","))[1]
  22.  
  23. dsquery user $DClocation -name $UserName | dsmod user -pwd $UserNewPass
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement