Create Lab AD – part 4

We have:

  1. Real names
  2. User Names (samAccountNames) with employee numbers
  3. OU names
  4. 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:

fredrik.wall@poweradmin.se

fredrik.wall@poweradmin.local

 

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.

This entry was posted in PowerShell Blogs and tagged , , . Bookmark the permalink.

3 Responses to Create Lab AD – part 4

  1. Pingback: Fredrik Wall

  2. RT @walle75: Add e-mail addresses, description and tele info http://bit.ly/8zt878, #AD #PowerShell <=cool article

  3. Fredrik Wall says:

    Add e-mail addresses, description and tele info http://bit.ly/8zt878, #AD #PowerShell

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>