Change Password and Unlock a bunch of users in AD


As Paul Venezia has outlined in is “Nine traits of the veteran Unix admin“:

Veteran Unix admin trait No. 8: We know more about Windows than we’ll ever let on

Though we may not run Windows on our personal machines or appear to care a whit about Windows servers, we’re generally quite capable at diagnosing and fixing Windows problems. This is because we’ve had to deal with these problems when they bleed over into our territory.

so when there is to reset the (same) silly password for tens test users on Active Directory and then unlockt them, who you gonna call©?

Someone that can’t despise more powershell to write something like this:

for($i=1; $i -le 70; $i++) { 
 $silly="sillyuser$i"
 Write-Output $silly
 Set-ADAccountPassword -Identity "$silly" -Reset -NewPassword (ConvertTo-SecureString -AsPlainText 'VerySecurePassword' -Force)
 Unlock-ADAccount -identity "$silly"
}

I’m keeping track here for the next time…