PEO Posted June 3, 2009 Posted June 3, 2009 Hi gang, I need to change all the staff and student passwords using a csv file I created last night. I need a script that will basically look at coloum1 for the username to search for that username and then use coloum 2 to change the users password. here is a script I found. Does this look like it will do the job? foreach($user in (import-Csv C:\UPass.csv)) { Write-Host "Setting Password for $($User.username)" $ds = new-Object System.DirectoryServices.DirectorySearcher([ADSI]"","(&(objectcategory=user)(sAMAccountName=$($user.username)))") $usr = ($ds.Findone()).GetDirectoryEntry() $usr.SetPassword($user.password) $usr.SetInfo() } cheers
PEO Posted June 3, 2009 Author Posted June 3, 2009 Ok, dosent matter I've figured it out and updated my lists.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now