Wednesday, May 2, 2012

User Demo

Well I need to test the view limits of the new Active Directory Administrative Center I needed a quick 10000 users.  So I started by clicking … Ok thats not going to happen.  I need a script and needed to work with the AD module introduced back in Windows Server 2008 R2.
First problem is to count through several users.  After a little research the best cmdlet for this is the For Loop and here is the syntax.  I started my testing only using 25 students.
For (variable=starting number ; variable less than or equal to last number ; increment)
for ($u = 0; $u -le 25; $u++) {
     $user = "Student"+$("{0:D2}" -f $u)
    Write-Host "Creating User for $user from $u"
}
NOTE that "+$("{0:D2}" cleans up the display to 2 characters
for ($u = 0; $u -le 25; $u++) {
     $user = "Student"+$("{0:D2}" -f $u)
    Write-Host "Creating User for $user from $u"
}
image
Now that I am counting I am ready to add user but running out of time today more to come later.