Removing AD Attributes

All those Set-* cmdlets are great at changing an attribute in AD, but how do you remove an attribute completely?

The answer is really straight-forward – you just set it to $null.

For example, to remove my City attribute I could use something like:

Set-QADUser "Dmitry Sotnikov" -City $null

In the general case of any attribute and any object use this syntax:

Set-QADObject identity –ObjectAttribute @{attributeName=$null}

Where identity is anything that can identify the object: samAccountName, DN, GUID, SID, canonical name; and attributeName is the name of the attribute you want to remove.

I guess this is one of those cases when the solution is so obvious you just forget to blog about it (until you get an IM from someone like xaegr asking ;))

Related topics:

Tags: , , ,

2 Responses to “Removing AD Attributes”

  1. 1 Owen February 9, 2016 at 1:55 pm

    Hi Dimitri,
    Love your blog. How can I modify the command to use wildcards for example to remove mobile attribute, can I change this:

    Set-QADObject identity –ObjectAttribute @{attributeName=$null}

    to the following:

    Set-QADObject mobile –ObjectAttribute @{attributeName=$null}

    and would this remove mobile from all of the AD users because that’s what I want to do.


    • 2 Dmitry Sotnikov February 11, 2016 at 3:46 am


      If ‘mobile’ is the name of the attribute – use it instead of the attributeName. And use samAccountName or another identifier of the account instead of identity.


Leave a Reply

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

You are commenting using your 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


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

December 2007
« Nov   Jan »

%d bloggers like this: