# Unlocking AD account - not working from command line

**URL:** <https://forums.powershell.org/t/unlocking-ad-account-not-working-from-command-line/10191>\
**Category:** PowerShell Help\
**Created:** [February 23, 2018, 12:28pm UTC](https://forums.powershell.org/t/unlocking-ad-account-not-working-from-command-line/10191 "2018-02-23T12:28:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nj-dude](https://avatars.discourse-cdn.com/v4/letter/n/ecae2f/32.png) [@nj-dude](https://forums.powershell.org/u/nj-dude)\
**Post date:** [February 23, 2018, 12:28pm UTC](https://forums.powershell.org/t/unlocking-ad-account-not-working-from-command-line/10191/1 "2018-02-23T12:28:29Z")

</div>

Hi There,

I have access to unlock AD accounts via the “Active Directory Users and Computers” console, however, if I try the same thing from the command line (Unlock-ADAccount) the system shows a “insufficient access rights” error even though I open the PS console with the account having rights to do that AND even enter the same account using the -Credentials parameter.

What’s going on?

---

<div class="post-metadata">

**Author:** ![sanchez](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@sanchez](https://forums.powershell.org/u/sanchez)\
**Post date:** [February 23, 2018, 12:53pm UTC](https://forums.powershell.org/t/unlocking-ad-account-not-working-from-command-line/10191/2 "2018-02-23T12:53:45Z")

</div>

Are you running powershell as admin?

---

<div class="post-metadata">

**Author:** ![nj-dude](https://avatars.discourse-cdn.com/v4/letter/n/ecae2f/32.png) [@nj-dude](https://forums.powershell.org/u/nj-dude)\
**Post date:** [February 23, 2018, 1:03pm UTC](https://forums.powershell.org/t/unlocking-ad-account-not-working-from-command-line/10191/3 "2018-02-23T13:03:45Z")

</div>

Yes, that account has domain admin rights.

To perhaps clarify this, I open the AD console using my domain admin account (Run As) and I can unlock accounts, I open the PS console using the same account, no dice.

---

<div class="post-metadata">

**Author:** ![sanchez](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@sanchez](https://forums.powershell.org/u/sanchez)\
**Post date:** [February 23, 2018, 1:10pm UTC](https://forums.powershell.org/t/unlocking-ad-account-not-working-from-command-line/10191/4 "2018-02-23T13:10:23Z")

</div>

Check out [this](https://support.microsoft.com/en-us/help/2577917/unlocking-a-user-account-fails-when-using-adac-or-the-unlock-adaccount)

Also running it with an account that has Domain Admin rights, is not the same thing as running powershell as administrator. Does the powershell bar says “Windows Powershell” or does it say “administrator: Windows powershell” ?

---

<div class="post-metadata">

**Author:** ![nj-dude](https://avatars.discourse-cdn.com/v4/letter/n/ecae2f/32.png) [@nj-dude](https://forums.powershell.org/u/nj-dude)\
**Post date:** [February 23, 2018, 1:55pm UTC](https://forums.powershell.org/t/unlocking-ad-account-not-working-from-command-line/10191/5 "2018-02-23T13:55:56Z")

</div>

Well my friend, I have to thank you for that link, applying the Hotfix mentioned solved the problem.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:36pm UTC](https://forums.powershell.org/t/unlocking-ad-account-not-working-from-command-line/10191/6 "2024-05-16T20:36:21Z")

</div>


