Get a list of ALL user properties

Learning something new every day. There was a question in the forums on PowerGUI.org today on obtaining a list of all attributes a user object has.

I used to think that the way to get the list of attributes exposed directly via PowerShell is to call:

PS:\> Get-QADUser | Get-Member

Or use a user as an example:

PS:\> Get-QADUser "Dmitry Sotnikov" | Format-List

And if you want to get to the more advanced AD properties (such as for example Msds-ResultantPSo in this example of managing fine-grained password policies) you are screwed and have to go to MSDN and read the AD schema docs.

As it turns out, this is not the case! You can get the full list of attributes available for a user object with this one call:

PS C:\> Get-QADUser -ReturnPropertyNamesOnly -IncludeAllProperties

objectClass
cn
instanceType
nTSecurityDescriptor
objectCategory
objectSid
sAMAccountName
...

Thanks to Rostislav for the tip!

In my network this gave 458 attributes so I am not providing the full output here.

See the whole thread here.

Tags: , , , , , , ,

UPDATE: Changed Format-Table to Format-List. Format-Table with no property names specified after it is more or less useless – it just gives the default output. Format-List by default lists all properties exposed directly via PowerShell with their values.

Advertisements

8 Responses to “Get a list of ALL user properties”


  1. 1 shea smith September 13, 2011 at 5:14 pm

    nice work. very helpful.

  2. 2 Connor March 6, 2012 at 5:01 pm

    You might want to mention that the quest active directory add-on is needed for this to work

  3. 3 Anonymous July 25, 2018 at 10:26 pm

    My biggest hurdle with this, is how do you query this for ALL USERS. It works perfectly if you specify the user with -indentity but I can’t find a way to pull this for all accounts in AD.


  1. 1 Set ANY AD attribute with PowerShell « Dmitry’s PowerBlog: PowerShell and beyond Trackback on July 25, 2007 at 11:11 am
  2. 2 Programmatically manipulate AD user attributes with PowerShell « Dmitry’s PowerBlog: PowerShell and beyond Trackback on February 11, 2008 at 10:15 am
  3. 3 Get Any AD User or Computer Object Property in PowerShell, Quickly! « Lange's Tech Musings Trackback on January 28, 2010 at 3:24 pm
  4. 4 Favorite Blog for Powershell stuff | Live@EDU Pearls Trackback on April 22, 2011 at 3:11 pm
  5. 5 Subscribe Confirmed Subscription to Posts on Dmitry’s PowerBlog: PowerShell and beyond « Wag the Real Trackback on September 17, 2011 at 12:48 pm

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 )

Google+ photo

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

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

June 2007
M T W T F S S
« May   Jul »
 123
45678910
11121314151617
18192021222324
252627282930  
Advertisements

%d bloggers like this: