How to create User Account using PowerShell in Active Directory. I’m using Windows Server 2012 R2, but this article will work with Windows Server 2008 to Server 2012 R2 or Server 2016.
A simple description about PowerShell. Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and CIM enabling management of remote Linux systems and network devices.
So if you have problem with creating objects in Active Directory with GUI, read the article: How to Create Objects in Active Directory?
Create User Account using PowerShell
In Windows Server run PowerShell and import Active Directory module or run Active directory module for Windows PowerShell from Tools in Server manager dashboard.
Type ‘Import-Module activedirectory’ and press enter to import the AD PowerShell module. This action will load all Active Directory commands for using in the current PowerShell window.
If you close the current PowerShell window, the Active Directory module will also exit and unload from PowerShell.
Type Get-Module and press enter to insure that module loaded successfully.
To see and list all active directory commands (CmdLet), just type ‘Get-Command -Module activedirectory’ and press enter then once explore all commands.
We need to create User Account with New-ADUser command. Type the below command and press enter.
PS C:\> New-ADUser -Name “Mehdi Hussaini” -GivenName Mehdi -Surname Hussaini -SamAccountName Mehdi -UserPrincipalName Mehdi@technig.local -AccountPassword (ConvertTo-SecureString -AsPlainText “PassW0rD” -Force ) -Enabled $true -ChangePasswordAtLogon $true
To get help for a command type ‘Get-Help New-ADUser -full’ or –example. The –full option will show you by details but the –example just show some examples for command.
To see if the user (Hehdi) has created or not, simply type ‘Get-ADUser -Identity Mehdi’ and press enter.
For getting full information about a user, type ‘Get-ADUser -Identity -Properties *’ then press enter.
That’s all, simple and easy. But it’s better to know the below Active Directory CmdLets for managing user account also.
1. To enable an Account type: ‘Enable-ADAccount -Identity mehdi’. This will enable the disabled user account immediately.
2. Disable an Account: ‘Disable-ADAccount -Identity Mehdi’
3. Reset the password of an account.
Please enter the desired password for ‘CN=Mehdi Hussaini,CN=Users,DC=Technig,DC=local’
Password: ********
Repeat Password: ********
PS C:\>
4. Remove a User Account: ‘Remove-ADUser -Identity Mehdi’
OK. Now you can create, modify, enable, disable, and delete a user account from active directory with Windows PowerShell within Windows Servers. Hope you enjoy to create user account using PowerShell
Hi dear sir can u teach me how to unlock youtube in good way which we can download high qualities video when we visit youtube from zacebook.com sometimes it cant work and when it works we cant download high quality videos
Hi Faraz, the free proxy services just let you watch YouTube online and blocked the downloading.
Use http://www.clipconverter.cc to convert and download the links or buy a premium VPN Apps.
this article becomes all too skillful if he or she are able to learn it, it was so great and super.
I’ve been browsing online more than three hours todɑy, уet I
never found any interesting article like yoսrs. It iѕ pretty worth еnough for me.
In my opinion, if all webmasters and bloggers maⅾe
good cօntent as үou did, thе web wіll be much moгe uѕeful
tһаn еver before.
It’s hard to come by well-informed people about this topic, however, you seem like you know what you’re talking about! Thanks