共用方式為


Exporting Objects to a CSV File

Applies To: Windows Server 2008 R2

This topic explains how to use the Active Directory module for Windows PowerShell to export objects in Active Directory Domain Services (AD DS) to a comma-separated value (CSV) file.

Example

The following example demonstrates how to export the OU ManagedGroups and all its child objects to a CSV file:

Get-ADObject -Filter 'Name -like "*"' -Searchbase 'OU=ManagedGroups,DC=Fabrikam,DC=com' | Export-CSV ExportOU.csv

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.