Share via


Set-ADUser -Manager - Want to Clear this field

Question

Thursday, February 7, 2013 11:16 PM

I have a script that is clearing user attributes.  I am stuck on clearing the manager attribute.  I've tried:

Set-ADUser testuser -Manager " " or Set-ADUser testuser -Manager "Blank"

From the command line, these fail with:

Set-ADUser : The search filter cannot be recognized
At line:1 char:1

  • Set-ADUser ittest -Manager " "

    + CategoryInfo          : NotSpecified: (ittest:ADUser) [Set-ADUser], ADEx
   ception
    + FullyQualifiedErrorId : The search filter cannot be recognized,Microsoft
   .ActiveDirectory.Management.Commands.SetADUser

Any pointers would be appreciated!

Thanks!

All replies (3)

Thursday, February 7, 2013 11:23 PM âś…Answered | 8 votes

Figured it out.

Set-ADUser ittest -manager $null

Done :)


Friday, February 8, 2013 8:33 AM

Thank you for letting us know the result!

TechNet Subscriber Support in forum |If you have any feedback on our support, please contact [email protected].


Saturday, February 9, 2013 1:59 AM | 5 votes

this works too:

$user = someusername

set-aduser $user -clear manager

-clear can take comma delimitation for multiple values too, for example  -clear manager, streetaddress, telephonenumber  ... etc if you need more than one property cleared.

-J