How to enable an Active Directory user account using PowerShell
To enable an Active Directory user account you will have to depend on the Enable-ADAccount or SetADUser cmdlet. This article explains how to enable an AD user account using PowerShell and ADManager Plus, a unified Active Directory, Office 365 and Exchange management and reporting tool. This article also explains why using ADManager Plus is the easiest option among the two.
Steps to enable an user AD account using PowerShell.
- Ensure you have the necessary permissions to perform this action, and also to execute PowerShell scripts.
- Get the value for necessary attributes like the the sAMAccountName, the distinguished name (DN), GUID, SID, etc. of the user account to be enabled.
- Create the script using the Enable-ADAccount cmdlet or Set-ADUser cmdlet, and execute it in the PowerShell window.
A sample PowerShell script to enable an AD account
Click to copy entire script
Enable-ADAccount -Identity "John Smith"
Set-ADUser -Identity "John Smith" -Enabled $true
This script will enable the user account 'John Smith'.
ADManager Plus offers purpose-built features for every type of AD object. So, for each object type, it offers an enable option. For example, to enable a user account,
- Select the Enable/Disable Users feature, located in User Management.
- Select the Enable option, the desired domain, and the names of user accounts to be enabled; you can even import the users list from a CSV file. Click Apply
» Start 30-day Free Trial
Limitations of using PowerShell to enable AD user accounts
- You will not be able to enable AD user accounts using PowerShell if you do not have enough privileges in AD to either create the user account or execute the script. With ADManager Plus, users' privileges in native AD or Exchange doesn't have to be elevated to enable user AD accounts.
- If you wish to enable AD user accounts in bulk or use a CSV file to enable multiple AD accounts using PowerShell, the script has to be modified. With ADManager Plus though, as the import CSV option is built-in, you can use the enable users feature to enable just one account or multiple accounts at once.
- You must know how to run the scripts from the PowerShell window. ADManager Plus is purely GUI-based, allowing you to perform all management and reporting actions with just mouse clicks from its web-based console.
- Even a misplaced hyphen, a typo in the LDAP names or lack of sufficient permission to configure any of the attributes used in the script will lead to errors. As all actions in ADManager Plus are GUI-driven, there is no need to write scripts, eliminating the chances of errors.