Failid ise saab alla laadida siit.

Faili sisu:

Import-Module activedirectory
Import-Csv “C:\ps\create_new_ad_users.csv” | ForEach-Object {
$upn = $_.SamAccountName + “@hkhk.edu.ee”
$uname = $_.FirstName + ” ” + $_.LastName
New-ADUser -Name $uname -DisplayName $uname
-GivenName $_.FirstName -Surname $_.LastName
-OfficePhone $_.Phone -Department $_.Department
-Title $_.JobTitle -UserPrincipalName $upn
-SamAccountName $_.SamAccountName -Path $_.OU
-EmailAddress $_.Email -HomeDirectory "\\opet-domeen\home\%uname%" -HomeDrive E:
-AccountPassword (ConvertTo-SecureString $_.Password -AsPlainText -force) -Enabled $true
}