Hello PS Gurus,
I have a PS script used to manipulate Active Directory accounts; it was working fine when running on one of our old Domain controllers (Win2008). However, we upgraded our DCs to Win2016 and decided to move this script to run on a separate Windows 2016 server. The main issue is that the script - which now runs on that separate server but invokes a session on the new DC - is no longer moving AD accounts to different OUs.
-The log shows this error:
“The input object cannot be bound to any parameters for the command either because the command does not take pipeline
input or the input and its properties do not match any of the parameters that take pipeline input.”
- And here’s the portion of the script that moves the AD account to a different OU but is not working:
“Get-ADUser $Student.sAMAccountName | Move-ADObject -TargetPath “OU=Old,OU=Students,DC=CH,DC=MCC,DC=edu” -ErrorAction Continue -Confirm:$false”
Searching online, it sounded like the Move-ADObject’s -Identity switch (required) is not accepting the piped sAMAccount attribute value so the suggestions were to try with a different attribute such as Distinguished name, GUID, etc. However, none of these work.
Appreciate your time and thanks in advance for any input!