Thursday, February 24, 2011

Counting Objects in Active Directory, Connecting to a Well-Known Container

Counting Objects in Active Directory

This topic explains how to use the Active Directory module for Windows PowerShell to retrieve the total number of objects that are stored in the Active Directory database.

Example

The following example demonstrates how to retrieve the total number of objects that are stored in the Active Directory database of the Fabrikam.com domain:
Get-ADObject -Filter {name -like '*'} -SearchBase 'CN=Schema,CN=Configuration,DC=Fabrikam,DC=COM' -ResultSetSize $null | Measure-Object

Additional information

For a full explanation of the parameters that you can pass to Get-ADObject or Measure-Object, at the Active Directory module command prompt, type Get-Help Get-ADObject –detailed or Get-Help Measure-Object, and then press ENTER.

Connecting to a Well-Known Container

This topic explains how to use the Active Directory module for Windows PowerShell to connect to a well-known container. A well-known container is an object in Active Directory Domain Services (AD DS), such as Users or Computers, that contains other objects.

Example

The following example demonstrates how to connect to the well-known containers in Active Directory Domain Services (AD DS):
Get-ADDomain Fabrikam.com | FL UsersContainer,ComputersContainer,DomainControllersContainer,DeletedObjectsContainer,SystemsContainer,LostAndFoundContainer,QuotasContainer,ForeignSecurityPrincipalsContainer

Additional information

For a full explanation of the parameters that you can pass to Get-ADDomain, at the Active Directory module command prompt, type Get-Help Get-ADDomain –detailed, and then press ENTER.

No comments:

Post a Comment