Created
December 1, 2015 00:34
-
-
Save lantrix/83c173603f6be844265d to your computer and use it in GitHub Desktop.
Unlock & Reset AD account powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $fool = 'aduseraccount' | |
| $adserver = 'adservername' | |
| Invoke-Command -ComputerName $adserver ` | |
| -ScriptBlock {param($u); Import-Module ActiveDirectory; Unlock-ADAccount -Identity $u} -ArgumentList $fool | |
| Invoke-Command -ComputerName $adserver ` | |
| -ScriptBlock {param($u); Import-Module ActiveDirectory; Set-ADAccountPassword -Identity $u -NewPassword (convertto-securestring "Passw0rd!" -asplaintext -force) -Reset} -ArgumentList $fool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment