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}
Note that the users are created in the Container Users.
Open dsa.msc and review your work.
Categories: PowerShell, Windows Server
How do you make it so the person names are chossen from a excel list and with OU groups in it
LikeLike
That’s a huge effort. I have no experience with importing from csv.
LikeLike
how do i change to make 500 instead? for example
LikeLike
Just Change 1..10 to 1..500
LikeLike
You have to count to 500
LikeLiked by 1 person