Answers for "powershell script to create dummy users in active directory"

1

powershell script to create dummy users in active directory

CREATE 1000 TEST / DUMMY USERS IN ACTIVE DIRECTORY (AD).

Import-Module ActiveDirectory
//Variables
$OU = "OU=TestUsers,DC=VirtualHike,DC=Internal"
$Domain = "virtualhike.internal"
$total = 1000

 for ($userIndex=0; $userIndex -lt $total; $userIndex++) 
 { 
  $userID = "{0:0000}" -f ($userIndex + 1)
  $userName = "VIEW$userID"

  Write-Host "Creating user" ($userIndex + 1) "of" $total ":" $userName

  New-ADUser `
   -AccountPassword (ConvertTo-SecureString "AAaaAAaa11!!11" -AsPlainText -Force) `
   -City "Amsterdam" `
   -Company "VirtualHike" `
   -Country "NL" `
   -Department "HomeLAB" `
   -Description ("TEST ACCOUNT " + $userID + ": This is a test account. Not a real user!")`
   -DisplayName "Test User ($userID)" `
   -Division "IT" `
   -EmailAddress "$userName@$Domain" `
    -EmployeeNumber "$userID" `
   -EmployeeID "ISED$userID" `
   -Enabled $true `
   -Fax "12345-$userID" `
   -GivenName "Test" `
   -HomePhone "12345-$userID" `
   -Initials "TU$userID" `
   -MobilePhone "12345-$userID" `
   -Name "Test User ($userID)" `
   -Office "Office: $userID"`
   -OfficePhone "12345-$userID" `
   -Organization "IT" `
   -Path $OU `
   -POBox "PO Box $userID"`
   -PostalCode $userID `a
   -SamAccountName $userName `
   -State "Noord Brabant" `
   -StreetAddress "$userID Sherwood" `
   -Surname "User ($userID)" `
   -Title "Title" `
   -UserPrincipalName "$userName@$Domain"
 }
Posted by: Guest on March-18-2021

Code answers related to "powershell script to create dummy users in active directory"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language