Powershell - Create 100 AD users

Hi, I had the need for 100 users for a test environment i was building. So heres the powershell script that i used to create them.




       Import-Module ActiveDirectory
1..100 | ForEach-Object { New-ADUser -Name "user$_" -path "ou=testou,dc=test,dc=local" }


heres another one

1..100 | ForEach-Object {
 New-ADUser
-Name "user$_"
-DisplayName "Test Account $_"
-givenname "user$_" -surname "$_"
-path "OU=mappe4,OU=adusers,DC=playground,DC=local"
-enabled $true
-AccountPassword(ConvertTo-SecureString "P@ssw0rd1" -AsPlainText -Force)
}



Popular posts from this blog

[SOLVED] Veeam: Failed change tracking (CBT)

Fixing Error 25541. Failed to open XML file