Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Resetting Users Password using dsquesry from a CSV
- ##### CSV Requirements #####
- ### First column need to be the name of the object in the OU, second column has to be the new Pass to set.
- # Paramaters to edit:
- param(
- $path = "C:\Users\roni\Desktop\123.csv",
- $DClocation = "OU=Fervital,OU=Hosting,DC=exsitu-testdc,DC=com"
- )
- # Loading the CSV file
- $HenUserList = get-content -Path $path
- # Looping through the users and setting their new passwords
- for ($i=0;$i -lt $HenUserList.count;$i++){
- $UserName = ($HenUserList[$i] -split (","))[0]
- $UserNewPass = ($HenUserList[$i] -split (","))[1]
- dsquery user $DClocation -name $UserName | dsmod user -pwd $UserNewPass
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement