PowerShell

PowerShell: How to create Active Directory Bulk Users with Standard Names

Many organizations are using standard user names for their employees. The reasons are manifold. For example, a school or a university with a high fluctuation can benefit from usernames student1 to student1000. In this article I’ll show you how to create bulk standard usernames.

The following code has to be executed on one of your domain controllers. The code gets your domain name automatically.

The code:

  • creates Student1 to Student10
  • all students are enabled
  • the account password is set to “Pa$$w000rd”
  • the user login is set to domain\Studentx  (SAM) and studentx@domainname.xxx (UPN)
  • all students have to change their password at first logon
1..10 | Foreach-Object {New-ADUser -Name Student$_ -AccountPassword (ConvertTo-SecureString "Pa$$w000rd" -AsPlainText -Force) -UserPrincipalName Student$_@$env:userdnsdomain -ChangePasswordAtLogon 1 -Enabled 1 -Verbose}

Unbenannt.PNG

Note that the users are created in the Container Users.

Open dsa.msc and review your work.

Unbenannt.PNG

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s