Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Creation of Ad users

$
0
0

Gentlemen,

This little script is working however the password and the user wont be "enabled" and "pswd never expires" won't be true after running script, could you please drop me a hint why?


The code:
Import-CSV c:\Scripts\Content.csv | New-ADUser
 -EmailAddress $_.EmailAddress
 -GivenName $_.GivenName
 -Surname $_.Surname
 -DisplayName $_.DisplayName
 -Name $_.Name
 -SamAccountName $_.SamAccountName
 -Description $_.Description
 -Department $_.Department
 -EmployeeID $_.EmployeeID
 -Path $_.Path
 -Password $_.Password
 -Enabled $True -AccountPassword (ConvertTo-SecureString $_.Password -AsPlainText -force)
 -PasswordNeverExpires $true

Example of the CSV file:
GivenName,Surname,Name,DisplayName,SamAccountName,Description,Department,EmployeeID,Path,Enabled,EmailAddress,Password,PasswordNeverExpires
First01,Secon01,Player01,Incredible_Hulk,Player01@uku.group,Player,Psngame,12312,"OU=TestUsers,DC=psn,DC=group",$True,hello01@psn.group,p@ssword,$True


Viewing all articles
Browse latest Browse all 6937

Trending Articles