Skip to content

Instantly share code, notes, and snippets.

@lantrix
Created December 1, 2015 00:34
Show Gist options
  • Select an option

  • Save lantrix/83c173603f6be844265d to your computer and use it in GitHub Desktop.

Select an option

Save lantrix/83c173603f6be844265d to your computer and use it in GitHub Desktop.
Unlock & Reset AD account powershell
$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