I'm trying to use Unlock-ADAccount in a powershell script running on a Windows Server 2012 R2 box. This is what I get:

PS C:\> unlock-adaccount
unlock-adaccount : The term 'unlock-adaccount' is not recognized as the name of a cmdlet, 
function, script file, or operable program. Check the spelling of the name, or if a path 
was included, verify that the path is correct and try again.
At line:1 char:1

I did find a SpiceWorks thread that says RSAT needs to be installed, but its for Windows 10. Can I even install RSAT on Server 2012 R2, and would that fix the missing cmdlet?

2 Answers 2


This requires the Remote Server Administration Tools (RSAT), which can be installed via the following PowerShell command: Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online.

Once this has been installed you can load the Active Directory PowerShell using the following PowerShell command: Import-Module ActiveDirectory or IPMO ActiveDirectory.

Once completed the Unlock-ADAccount may be used among other commands from associated RSAT modules


I guess I was just being dumb. I looked in Server Manager and under Features -> Remote Server Administration Tools -> Role Administration Tools -> AD DS and AD LDS Tools you just click Enable Active Directory module for Windows PowerShell.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .