Quantcast
Viewing all articles
Browse latest Browse all 10

Lab Test Users

Setting up a test domain often requires some users. Since I am seeing a need to set up a test environment a few different times I figured I'd spend the time to automate it. I looked around for some names lists and figured I would just raid character names from the works of Jane Austin, it gives me some variety.

I just set the user password to the same thing and this script is set to read from user.txt in the same directory and enable the accounts.

$users=Import-Csv .\users.txt -Delimiter','$password=Read-Host"Enter password for all test users: "-AsSecureString 
foreach($userin$users){$name="$($user.First) $($user.Last)"
    New-ADUser -Name"$($user.First) $($user.Last)"-DisplayName$name-GivenName $($user.First)-Surname $($user.Last)-SamAccountName "$($user.First)$($user.Last)"-AccountPassword $Password-PasswordNeverExpires $true-Enabled $true-Description"User Test Account"}

Viewing all articles
Browse latest Browse all 10

Trending Articles