Clear AD attribute

Just yesterday a colleague of mine asked me how to undo an Active Directory object property change from the value he erroneously put back to <not set>. It turned out that I never actually blogged about that – so here you go.🙂

Clearing AD attributes us actually as easy as just setting the value to $null. For example, here’s how you do it for properties which we have exposed in Set- cmdlets parameters:

Set-QADUser 'Amy Hardy' -City $null

Or for more internal attributes:

Set-QADUser 'Amy Hardy' -ObjectAttributes @{adminDescription=$null}

Hope that helps!

5 Responses to “Clear AD attribute”


  1. 1 AnthonyA March 4, 2013 at 9:16 pm

    Finally figured out how to do this without the Quest extensions.
    $userobj = [ADSI]”LDAP://cn=myname.OU=People.DC=example,DC=com”
    $userobj.put(“description”,@())
    $userobj.SetInfo()

    The empty array is necessary to clear the description without error, not sure why, but I believe it is because @() actually generates a null array object. $null does not work; it gives you errors.

  2. 2 karthik November 13, 2014 at 12:15 pm

    how to do this for multiple users

  3. 4 Francis January 26, 2015 at 8:19 am

    thanks a lot!! it really helped me.. i used the following..

    Get-QADUser -ObjectAttributes @{extensionAttribute10=’*’} | Set-QADUser -ObjectAttributes @{extensionAttribute10=$null}


  1. 1 Episode 138 – Parind Shah from EqualLogic « PowerScripting Podcast Trackback on February 1, 2011 at 2:53 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




My Recent Tweets

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

January 2011
M T W T F S S
« Dec   Feb »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

%d bloggers like this: