The command is:
New-ADUser –SamAccountName “TestProvider” -UserPrincipalName "TestProv@CompanyName.com” -GivenName “Test” -Surname “Provider” -DisplayName “Test Provider” -Name "Test Provider" -Enabled $true -path “ou=CompanyName,ou=Users,ou=Providers,DN=intranet,DN=CompanyName,DN=com” -AccountPassword (ConvertTo-SecureString "TEST123test" -AsPlainText -force) -PasswordNeverExpires $True
The error is:
New-ADUser : No superior reference has been configured for the directory service. The directory service is therefore un
able to issue referrals to objects outside this forest
At line:1 char:11+ New-ADUser <<<< -SamAccountName "TestProvider" -UserPrincipalName "TestProv@CompanyName.com" -GivenName "Test" -
Surname "Provider" -DisplayName "Test Provider" -Name "Test Provider" -Enabled $true -path "ou=CompanyName,ou=Users,ou=
Providers,DN=intranet,DN=CompanyName,DN=com" -AccountPassword (ConvertTo-SecureString "TEST123test" -AsPlainText -force
) -PasswordNeverExpires $True+ CategoryInfo : NotSpecified: (CN=Test Provide...panyName,DN=com:String) [New-ADUser], ADException+ FullyQualifiedErrorId : No superior reference has been configured for the directory service. The directory servi
ce is therefore unable to issue referrals to objects outside this forest,Microsoft.ActiveDirectory.Management.Comm
ands.NewADUserI think it has something to do with the way I'm specifying the "path" but i'm not sure.
The user should be created in an OU: CompanyName > Users > Providers
The domain is intranet.companyname.com