This is the built-in help made by Microsoft for the command 'Get-ADObject', in PowerShell version 5 - as retrieved from
Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.
For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.
Gets one or more Active Directory objects.
Get-ADObject [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-IncludeDeletedObjects] [-Properties <String[]>] [-ResultPageSize <Int32>] [-ResultSetSize
<Int32>] [-SearchBase <String>] [-SearchScope {Base | OneLevel | Subtree}] [-Server <String>] -Filter <String> [<CommonParameters>]
Get-ADObject [-Identity] <ADObject> [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-IncludeDeletedObjects] [-Partition <String>] [-Properties <String[]>]
[-Server <String>] [<CommonParameters>]
Get-ADObject [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-IncludeDeletedObjects] [-Properties <String[]>] [-ResultPageSize <Int32>] [-ResultSetSize
<Int32>] [-SearchBase <String>] [-SearchScope {Base | OneLevel | Subtree}] [-Server <String>] -LDAPFilter <String> [<CommonParameters>]
The Get-ADObject cmdlet gets an Active Directory object or performs a search to retrieve multiple objects.
The Identity parameter specifies the Active Directory object to get. You can identify the object to get by its distinguished name (DN) or GUID. You can also set the
parameter to an Active Directory object variable, such as $<localADObject> or pass an object through the pipeline to the Identity parameter.
To search for and retrieve more than one object, use the Filter or LDAPFilter parameters. The Filter parameter uses the PowerShell Expression Language to write query strings
for Active Directory. PowerShell Expression Language syntax provides rich type conversion support for value types received by the Filter parameter. For more information
about the Filter parameter syntax, type Get-Help about_ActiveDirectory_Filter. If you have existing LDAP query strings, you can use the LDAPFilter parameter.
This cmdlet gets a default set of Active Directory object properties. To get additional properties use the Properties parameter. For more information about the how to
determine the properties for computer objects, see the Properties parameter description.
<
Online Version: http://go.microsoft.com/fwlink/p/?linkid=291034
New-ADObject
Remove-ADObject
Set-ADObject
<
-------------------------- EXAMPLE 1 --------------------------
PS C:\>Get-ADObject -LDAPFilter "(objectClass=site)" -SearchBase 'CN=Configuration,DC=Fabrikam,DC=Com' -Properties CanonicalName | FT Name,CanonicalName -A
Name CanonicalName
---- -------------
HQ FABRIKAM.COM/Configuration/Sites/HQ
BO1 FABRIKAM.COM/Configuration/Sites/BO1
BO2 FABRIKAM.COM/Configuration/Sites/BO2
BO3 FABRIKAM.COM/Configuration/Sites/BO3
This command displays a list of sites for Fabrikam using the LDAP filter syntax.
-------------------------- EXAMPLE 2 --------------------------
PS C:\>Get-ADObject -Filter 'ObjectClass -eq "site"' -SearchBase 'CN=Configuration,DC=Fabrikam,DC=Com' -Properties siteObjectBL | foreach {$_.siteObjectBL}
CN=192.167.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.166.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.168.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.165.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.164.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.163.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.162.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.161.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.160.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.159.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.158.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
CN=192.157.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM
This command gets the Site objects from the Configuration Naming Context and then enumerates through the list outputting siteObjectBL.
-------------------------- EXAMPLE 3 --------------------------
PS C:\>$changeDate = New-Object DateTime(2008, 11, 18, 1, 40, 02)
PS C:\> Get-ADObject -Filter 'whenChanged -gt $changeDate' -IncludeDeletedObjects
This command gts all the objects, including the deleted ones, whose whenChanged attribute is greater than the specified date. Note that both deleted and non-deleted (and
non-recycled) objects matching the filter will be returned.
-------------------------- EXAMPLE 4 --------------------------
PS C:\>$changeDate = New-Object DateTime(2008, 11, 18, 1, 40, 02)
PS C:\> Get-ADObject -Filter 'whenChanged -gt $changeDate -and isDeleted -eq $true -and -not (isRecycled -eq $true) -and name -ne "Deleted Objects"' -IncludeDeletedObjects
ObjectGUID : 98118958-91c7-437d-8ada-ba0b66db823b
Deleted : True
DistinguishedName : CN=Andrew Ma\0ADEL:98118958-91c7-437d-8ada-ba0b66db823b,CN=Deleted Objects,DC=FABRIKAM,DC=COM
Name : Andrew Ma
DEL:98118958-91c7-437d-8ada-ba0b66db823b
ObjectClass : user
This example gets all the deleted objects, whose whenChanged attribute is greater than the specified date. The clause name -ne "Deleted Objects" makes sure that the Deleted
Objects Container is not returned. This will only return objects which can be restored.
-------------------------- EXAMPLE 5 --------------------------
PS C:\>$changeDate = New-Object DateTime(2008, 11, 18, 1, 40, 02)
PS C:\> Get-ADObject -Filter 'whenChanged -gt $changeDate -and isDeleted -eq $true -and -not (isRecycled -eq $true) -and lastKnownParent -eq
"OU=Accounting,DC=Fabrikam,DC=com"' -IncludeDeletedObjects
ObjectGUID : 12d53e7f-aaf7-4790-b41a-da19044504db
Deleted : True
DistinguishedName : CN=Craig Dewar\0ADEL:12d53e7f-aaf7-4790-b41a-da19044504db,CN=Deleted Objects,DC=Fabrikam,DC=com
Name : Craig Dewar
DEL:12d53e7f-aaf7-4790-b41a-da19044504db
ObjectClass : user
This example gets all the deleted objects whose whenChanged attribute is greater then the specified date and at the time of deletion were the children of the specified
Organizational Unit.
-------------------------- EXAMPLE 6 --------------------------
PS C:\>Get-ADObject -Identity "DC=AppNC" -server "FABRIKAM-SRV1:60000"
ObjectGUID DistinguishedName Name ObjectClass
---------- ----------------- ---- -----------
62b2e185-9322-4980-9c93-cf... DC=AppNC AppNC domainDNS
This command gets the information of the domainDNS object of an LDS instance.