I am working on creating a script to copy specific information from an existing AD User into a new account. The script is giving me 3 errors, the third one i know is because the script fails before it gets to that section.
Get-ADUser : The operation returned because the timeout limit was exceeded.
At line:115 char:14
+ $New_Path = (Get-ADUser ($UsernameCopy.Text)).DistinguishedName -repl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationTimeout: (cnelsontest:ADUser) [Get-ADUser], TimeoutException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.TimeoutException,Microsoft.ActiveDirectory.Management.Commands.GetADUser
New-ADUser : Cannot validate argument on parameter 'Path'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command
again.
At line:155 char:35
+ New-ADUser -Name $New_DisplayName @params
+ ~~~~~~~
+ CategoryInfo : InvalidData: (:) [New-ADUser], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.NewADUser
Add-ADGroupMember : Cannot find an object with identity: 'cnelsontest1' under: 'DC=azcorrections,DC=local'.
At line:159 char:29
+ Add-ADGroupMember -Members $Username.Text
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (cnelsontest1:ADPrincipal) [Add-ADGroupMember], ADIdentityNotFoundException
+ FullyQualifiedErrorId : SetADGroupMember.ValidateMembersParameter,Microsoft.ActiveDirectory.Management.Commands.AddADGroupMember
Here is the line the first error refers to:
$New_Path = (Get-ADUser ($UsernameCopy.Text)).DistinguishedName -replace '^.*?,\s*(?=ou=)', ''
I have a feeling the second error message is caused by the first error, and the third error message is because it doesn't complete the New-ADUser command.
I'm running PSVersion 5.1.150
Edit: Can someone assist me in figuring out what the error messages mean as well as how to fix it?