Searching for Objects in a Domain
Updated: February 28, 2009
Applies To: Windows Server 2008 R2
This topic explains how to use the Active Directory module for Windows PowerShell to search for objects in a domain in Active Directory Domain Services (AD DS).
The following example demonstrates how to search for all the computer objects in the Fabrikam.com domain:
Get-ADObject -Filter 'ObjectClass -eq "computer"' -SearchBase 'DC=Fabrikam,DC=com' -Properties Name,sAMAccountName | FT Name,sAMAccountName
In addition to the standard Lightweight Directory Access Protocol (LDAP) attributes, you can retrieve the following extended properties of the Get-ADObject cmdlet by using the -Properties parameter:
- ObjectClass
- Created
- Modified
- Deleted
- ProtectedFromAccidentalDeletion
For a full explanation of the parameters that you can pass to Get-ADObject, at the Active Directory module command prompt, type Get-Help Get-ADObject –detailed, and then press ENTER.
