Getting Active Directory Account Information

by Oct 17, 2013

In a previous script you have discovered how easy it is to find Active Directory accounts with just some simple PowerShell code. The result is a search result object, not the actual account object.

To get more detailed information about an account, use GetDirectoryEntry() to turn the search result into actual account objects:

# get 10 results max
$searcher.SizeLimit = 10

# find account location
$searcher.FindAll() | 
  # get account object
  ForEach-Object { $_.GetDirectoryEntry() } |
  # display all properties
  Select-Object -Property * |
  # display in a grid view window (ISE needs to be installed for this step)
  Out-GridView 

Twitter This Tip! ReTweet this Tip!