I am trying to remove/delete manager information from the moved users OU, and the PS script is working for single user as below but while i am trying to search for moved OU in the domain, and try to remove manager information for all users those belong to that OU returning with error, could you please advise.
Set-ADUser ittest -manager $null
The below script is not working:
$Server = "dc01.test.com"
$SearchBase = "OU=Moved Users,DC=test,DC=com"
Get-ADUser -Identity * -Server $Server -SearchBase $SearchBase -Properties * |
Select-Object -Property | Set-ADUser -manager $null
Get-ADUser : Parameter set cannot be resolved using the specified named paramet
At line:1 char:11
+ Get-ADUser <<<< -Identity * -Server $Server -SearchBase $SearchBase -Propert
ies * |
+ CategoryInfo : InvalidArgument: (:) [Get-ADUser], ParameterBind
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.ActiveDirectory.
Could you please advise.