Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Powershell one liner: Create multiple user accounts

August 9, 2017 10:44PM

I had an opportunity to teach PowerShell Active Directory basics to some of my junior subordinate, Where I wanted them to show few test cases on creating multiple active directory user accounts, After building active directory from scratch, As this was the demo example lab, accounts created  running below one liner, I can create n number of user accounts in one shot, without wasting any time. Once command is executed it creates 20 accounts, name starting with user in the given ldap ou path. Password is blank and it will be asking for password upon login.

POWERSHELL: INSTALLING AND CONFIGURING ACTIVE DIRECTORY 

1..20 | foreach {New-ADUser -Name user$_ -PasswordNotRequired $true -Enabled $true -Path 'ou=Temp-Users, dc=vcloud-lab, dc=com'}

Active directory users and computers, New-AdUser Passwordnotrequired path ou organization unit, enabled user account

Useful articles
POWERSHELL: INSTALLING AND CONFIGURING ACTIVE DIRECTORY 
POWERSHELL ACTIVE DIRECTORY: ADD OR UPDATE (CHANGE) MANAGER NAME IN ORGANIZATION TAB OF USER
POWERSHELL ACTIVE DIRECTORY: ADD OR UPDATE PROXYADDRESSES IN USER PROPERTIES ATTRIBUTE EDITOR
Powershell one liner: Create multiple user accounts
Active Directory Powershell: Create bulk users from CSV file

Go Back

Comment