Dear all,
I am using below script to Create Bulk AD Users from CSV. Filewhich contains set of New AD Users to create with the attributes Name, samAccountName and ParentOU. I want add the first name, last name, display name and groups to the csv file. Can anyone guide me what to change ?
Import-ModuleActiveDirectory
Import-Csv'C:ScriptsNewUsers.csv'| ForEach-Object{
$userPrincinpal= $_.'samAccountName'+ '@TestDomain.Local'
New-ADUser-Name$_.Name `
-Path$_.'ParentOU'`
-SamAccountName$_.'samAccountName'`
-UserPrincipalName$userPrincinpal`
-AccountPassword(ConvertTo-SecureString'MyPassword123'-AsPlainText-Force) `
-ChangePasswordAtLogon$true`
-Enabled$true
Add-ADGroupMember'Domain Admins'$_.'samAccountName';
}
Thanks