Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

AD accounts from CSV

$
0
0

Does anybody see anything wrong with this PS script to create AD users from a CSV.

Import-Module-NameActiveDirectory 


$newpath

="d:\adaccount.csv"


Import-CSV

$newpath|FOREACH-OBJECT{$newpath}

{



New-ADUser

-Name$_.FirstName+' '+$_.LastName-AccountPassword(ConvertTo-SecureString"Pass@123"-AsPlainText-force)-Enabled$True-City$_.City-Company$_.Company-Department$_.Department-Description$_.Description-GivenName$_.FirstName-Path"OU=Security,OU=Users,OU=PAC,OU=TEST,DC=TEST,DC=org"-SamAccountName$_.AccountLogin-Surname$_.LastName-UserPrincipalName$_.AccountLogin+"@test.org"-DisplayName$_.FirstName+' '+$_.LastName-Title$_.Title-StreetAddress$_.StreetAddress-State$_.State-PostalCode$_.PostalCode-Office$_.Office-ChangePasswordAtLogon$False-CannotChangePassword$True


}


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>