Powershell Tip of the day – Getting the properties of an obect listed by get-member

If you want to query Active Directory, using powershell, odds are you’ll end up doing something like this eventually if you don’t have the ActiveDirectory module:

 $ad = New-Object system.directoryservices.directorysearcher samaccountname=$id   

That’s all fine and dandy, but how many different properties does $ad have and what exactly are they? That’s actually pretty easy to find, but every time I need this I always forget how and end up wasting an hour or more trying to figure it out again, here’s how:

($ad.findall())[0].properties
About these ads
This entry was posted in Uncategorized. Bookmark the permalink.

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 )

Connecting to %s