Share via


Importing Objects by Using a CSV File

Applies To: Windows Server 2008 R2

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

Example

The following example demonstrates how to import the organizational unit (OU) ManagedGroups and all its child objects from a CSV file:

Import-CSV ImportOU.csv | foreach {New-ADObject -Path $_.Path -Name $_.Name -Type $_.Type}

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 Get-NewObject –detailed, and then press ENTER.