posted 17/12/09

Create Lab AD – part 4

By Fredrik Wall

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

 

Related posts:

  1. Create Lab AD – part 3
  2. Create Lab AD (continue)
  3. Create Lab AD Functions (Updated)
  4. Create Lab AD – part 5
  5. Create Lab AD – Part 6


Comments
MSFT Scripting Guys WordPress v1.1.3 December 17th, 2009 (8:51 am)
comment

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

Fredrik Wall WordPress v1.1.3 December 17th, 2009 (9:44 am)
comment

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

Add Comment

Name (Required)

E-mail (Required)

Website

Comment (Required)