Powershell – Active Directory Modules – Pulling down Properties

Powershell

Here’s a quick but important one.

One of the advantages (or disadvantages if you’re the half cup empty type) is that the Active Directory Cmdlets (unlike their Quest counterparts) seem to pull down LESS information.

This is of course “poppycock”.   They both have the ability to pull the same information down (Active Directory doesn’t change between Cmdlets) but by DEFAULT for speed the Active Directory modules only pull down very key information.

But the rest is available to you with an easy command.

GET-ADUSER –identity ‘John.Smith’

Will give you the Information for ‘John.Smith’ but only a limited set.   The reason for this is you’re asking Active Directory for information.   The more info you pull (Especially non indexed) the slower the query is.

GET-ADUSER –identity ‘John.Smith’ –properties *

Will pull down ALL the properties for ‘John.Smith’, but it’s still not useful, you need names and Examples of the properties.

GET-ADUSER –identity ‘John.Smith’ –properties * | GET-MEMBER | FORMAT-LIST

Will display all those available properties and their examples on the screen.  But personally I like having a easy to view reference point.

GET-ADUSER –identity ‘John.Smith’ –properties * | GET-MEMBER | EXPORT-CSV C:PowershellADSample.CSV

Will create a CSV file called “ADSample.CSV” which you can load into any Spreadsheet to view the content.   Here’s the easy part.   Top row is your NAMES of your PROPERTIES in Active Directory.   Bottom row is live data.   

Knowing what you can pull down is sometimes half the battle to knowing what you can change.

So once you know WHAT you want to pull out of Active Directory, the Command  is easy

GET-ADUSER –identity ‘John.Smith’ –Properties Property1, Property2

See?  Piece of Cake.  Your work is done.

Now that you’re done work without trying, sit back and enjoy some cold Iced Tea.  IT’s HOT today!

The Power of Shell is in YOU

Sean
The Energized Tech

Leave a Reply