Starting powershell 3.0, modules can be loaded automatically without manually import everytime. So make sure you at least have powershell 3.0 installed. Add new user via powershell: New-ADUser –Name "John Smith" –SamAccountName JohnS –DisplayName "John Smith" –Title "Account Manager" –Enabled $true –ChangePasswordAtLogon $true -AccountPassword (ConvertTo-SecureString "<a href="mailto:[email protected]">[email protected]</a>" -AsPlainText -force) -PassThru In some case, we may need pipe to combin two or more commands and actions together, but we can’t use pipe after powershell command.
In the next few paragraphs I show you my method to create hundreds of test users on Windows Server 2012 with Powershell. First of all you need permissions to be able to create users. Your machine needs the Powershell module from the Remote Server Administration Tools, check it here: Features/Remote Server Administration Tools/Role Administration Tools/AD DS and AD LDS Tools/Active Directory module for Windows Powershell. Show-Command New-ADUserThe first command shows you the command’s help in a separate window where you browse or search.
A request has been received to grant additional permissions to an existing user in your organizations Active Directory environment. The username of this existing user is “frank0”. In additional to his current responsibilities, Frank will be taking on the responsibilities of Alan who goes by the username of “alan0”. Note: The examples shown in this blog article are being performed on a Windows 8.1 machine that has theremote server administration toolsinstalled.