Thursday, February 24, 2011

Creating an Object,Searching the Global Catalog, Searching for Objects in a Domain

Creating an Object

This topic explains how to use the Active Directory module for Windows PowerShell to create an object in Active Directory Domain Services (AD DS).

Example

The following example demonstrates how to create a new site object in the Fabrikam.com domain:
New-ADObject -Name 'BO3' -Type site -Description 'Branch Office 3' -Path 'CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM'

Additional information

The following parameters are the most commonly used parameters for creating Active Directory objects:
  • -Description
  • -DisplayName
  • -ProtectedFromAccidentalDeletion
For a full explanation of the parameters that you can pass to New-ADObject, at the Active Directory module command prompt, type Get-Help New-ADObject –detailed, and then press ENTER.

Searching the Global Catalog

This topic explains how to use the Active Directory module for Windows PowerShell to connect to and search the global catalog.

Example

The following example demonstrates how to connect to and search the global catalog for all the users in the Fabrikam forest:
Get-ADObject -Filter 'ObjectClass -eq "users"' –Server corp-DC12:3268 -SearchBase 'DC=Fabrikam,DC=com' -Properties Name,sAMAccountName | FT Name,sAMAccountName

Additional information

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.
 
 
Searching for Objects in a Domain

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).

Example

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

Additional information

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.

No comments:

Post a Comment