Download script here

Requirements:

– Powershell 2.0

– CSV file

Attributes Used:

  • FirstName
  • LastName
  • City
  • Department
  • Job Title
  • Logon Name
  • Password
  • Description
  • E-Mail
  • Script (Logon Script)
  • H drive (Logon file share letter)
  • domain name

PS1 script:

Function Provision {

PROCESS {

Write-Host $_.samAccountName

}

}

Function ProvisionInputCSV {

Param ([string]$filename)

$users = Import-CSV C:\powershell\users.csv

foreach ($user in $users) {

$ht = @{‘givenName’=$user.”First Name”;

‘sn’= $user.”Last Name”;

‘title’= $user.”Job Title”;

‘department’= $user.Department;

‘displayName’= $user.”First Name” + ” ” + $user.”Last Name”;

‘city’= $user.”City”;

‘password’= $user.Password;

‘samAccountName’= $user.”Logon Name”;

‘description’= $user.”Description”;

‘mail’= $user.”E-Mail”;

‘scriptPath’= $user.script;

‘homeDrive’= $user.”H drive”;

‘userPrincipalName’= $user.”domain name”

}

Write-Output $ht

}

}

ProvisionInputCSV c:\powershell\users.csv | Provision

This script is using the following