Requirement – They want to create 150 Active Directory users with username and password being the same.
Login to Active Directory Server (Domain Controller) Save below to .ps1 , Open Active Directory Power shell, You can customize as per your wish.
Note:This forest doesn’t have strict password policy.It allows simple passwords. If you want to use a common password for all the users you can save $randompassword = “somepass” and use it after Convertto-securestring replacing $name.
$numberofusers = "125" $Prefix = "Labuser" $Suffix = "@domain.local" $pathOU = “OU=Lab,DC=Dubai,DC=com” For($i=1;$i -le $numberofusers;$i++) { $UPN = "$Prefix"+"$i"+"$Suffix" $Name = "$Prefix"+"$i" $Password = Convertto-SecureString "$name" -Asplaintext -Force New-ADUser -Name $Name -SamAccountName $Name -Path $pathOU -UserPrincipalName $UPN -Enabled $True -AccountPassword $Password -PasswordNeverExpires $True -CannotChangePassword $True -verbose }
Sample Screenshots –
Active Directory Powershell –
Active Directory Users and Computers –