Using PowerShell to create a new Active Directory user
Creating new user accounts in Active Directory is pretty standard stuff, but doing it the traditional way requires a lot of mouse clicks. Since we know that PowerShell can be used to accomplish anything within Windows Server 2019, but not many people actually employ it regularly, let's implement this common task as a recipe to be accomplished with PowerShell rather than the GUI.
Getting ready
We will use PowerShell on any Windows machine that is either a DC or has the Active Directory RSAT tools installed.
How to do it…
Follow along to create a new user account in Active Directory by using the PowerShell Command Prompt:
- Launch a PowerShell Command Prompt as an Administrator.
- Enter the following command in order to create a new user account with very simple parameters:
Import-Module ActiveDirectory New-ADUser -Name 'John Smith' -UserPrincipalName '
jsmith@cookbook.packt.com
&apos...