Hi and Happy new year. I am doing a test run on my syntax before expanding my script but this error is driving me crazy. When I leave out the -path it works fine but when I try and Include a path it errors out and I cant figure out how it wants -path to be inputted. See below:
PS C:\Windows\system32> Import-Module -Name ActiveDirectory
New-ADUser `
-Name 12WWallis `
-CannotChangePassword 1 `
-ChangePasswordAtLogon 0 `
-Description Student `
-DisplayName "Will Wallis" `
-Enabled 1 `
-GivenName Will `
-HomeDirectory \\Server1\12WWallis$\Documents `
-HomeDrive N: `
-Initials WW `
-PasswordNeverExpires 1 `
-Path OU=YOE2012 `
-SamAccountName 12WWallis `
-Surname Wallis `
-UserPrincipalName 12WWallis@TestDomain.NET
New-ADUser : No superior reference has been configured for the directory service. The directory service is
therefore unable to issue referrals to objects outside
this forest
At line:2 char:1
+ New-ADUser `
+ ~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (CN=12WWallis,OU=YOE2012:String) [New-ADUser], ADException
+ FullyQualifiedErrorId : ActiveDirectoryServer:8406,Microsoft.ActiveDirectory.Management.Commands.NewADUser
PS C:\Windows\system32> Import-Module -Name ActiveDirectory
New-ADUser `
-Name 12WWallis `
-CannotChangePassword 1 `
-ChangePasswordAtLogon 0 `
-Description Student `
-DisplayName "Will Wallis" `
-Enabled 1 `
-GivenName Will `
-HomeDirectory \\Server1\12WWallis$\Documents `
-HomeDrive N: `
-Initials WW `
-PasswordNeverExpires 1 `
-Path ou=YOE2012,ou=Students,DC=TestDomain,DC=NET `
-SamAccountName 12WWallis `
-Surname Wallis `
-UserPrincipalName 12WWallis@TestDomain.NET
New-ADUser : Cannot convert 'System.Object[]' to the type 'System.String' required by
parameter 'Path'. Specified method is not supported.
At line:14 char:7
+ -Path ou=YOE2012,ou=Students,DC=TestDomain,DC=NET `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-ADUser], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.ActiveDirectory.Management.Commands.NewADUser