We have:
- Real names
- User Names (samAccountNames) with employee numbers
- OU names
- Country Names
If you have missed them, look in my older posts about
Create Lab AD.
In this part we will do:
Mail addresses
Telephone numbers
User Description
We will start with the mail addresses.
$myUserCountry = $userCountry | Get-Random switch ($myUserCountry) { 'Sweden' {$userCoutryCode = "se"} 'Denmark' {$userCoutryCode = "dk"} 'Finland' {$userCoutryCode = "fi"} 'Norway' {$userCoutryCode = "no"} default {$userCoutryCode = "local"} }
$userEmail = $userFirstName + "." + $userLastName + "@poweradmin." + $userCoutryCode
This will give us mail addresses like:
The domain name of your AD can easily be put there automatically.
For the telephone numbers I will use this little code.
$userLastTele = Get-Random -Minimum 1000 -Maximum 9999
$userTele = "+468440 " + $userLastTele
It will give us numbers like +4684402022 and +4684409988
The last thing I need before It’s time to do the add to AD part is the User description.
$userDescription = $firstName + " " + $lastName + " at " + $mylabOUs + " in " + $myUserCountry
This will give us this output:
Hadar Möller at Marketing in Norway
Peter Klint at Operations in Finland
Ylva Sten at Service in Sweden
So now we can put this together with
$firstName + " " + $lastName + " - " + $userSAM + " - " + $userEmail + " - " + $mylabOUs +
" - " + $userTele + " - " + $myUserCountry + " - " + $userDescription
and get
Hadar Möller – hamo63343 – hadar.moller@poweradmin.no – Marketing – +468440 5244 -
Norway – Hadar Möller at Marketing in Norway
Peter Klint – pekl78132 – peter.klint@poweradmin.fi – Operations – +468440 1661 – Fi
nland – Peter Klint at Operations in Finland
Ylva Sten – ylst53520 – ylva.sten@poweradmin.se – Service – +468440 7002 – Sweden -
Ylva Sten at Service in Sweden
Next post will be a start on the way to add these users to the AD
No related posts.
Pingback: Fredrik Wall
RT @walle75: Add e-mail addresses, description and tele info http://bit.ly/8zt878, #AD #PowerShell <=cool article
Add e-mail addresses, description and tele info http://bit.ly/8zt878, #AD #PowerShell