Hi,
I have tried several scripts to import users into AD via CSV. I'd like to simplify the import if I can. Here's what I'd like to use:
Import-Csv "c:\temp\Users.csv" | foreach-object {$userprinicpalname = $_.AccountName + "@company.com"
New-ADUser -SamAccountName $_.AccountName -UserPrincipalName $userprinicpalname -Name $_.name -DisplayName $_.name -Title $_.Title -Department $_.Department -Company $_.Company -Manager $_.Manager -Description $_.Description -Path "CN=employees,DC=company,DC=com"
-AccountPassword (ConvertTo-SecureString "password" -AsPlainText -force) -Enabled $True -PasswordNeverExpires $True -PassThru }
When I run this script I get an error on "New-ADUser : Directory object not found". I also have my CSV formatted with the headers mentioned in the script setup in the order the script calls them.
Any assistance would be greatly appreciated. Thanks.
Georgi