PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'New-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.


Creates an Active Directory object.


New-ADObject [-Name] <String> [-Type] <String> [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Description <String>] [-DisplayName <String>] [-Instance
<ADObject>] [-OtherAttributes <Hashtable>] [-PassThru] [-Path <String>] [-ProtectedFromAccidentalDeletion <Boolean>] [-Server <String>] [-Confirm] [-WhatIf]

Search powershellhelp.space


The New-ADObject cmdlet creates a new Active Directory object such as a new organizational unit or new user account. You can use this cmdlet to create any type of Active
Directory object. Many object properties are defined by setting cmdlet parameters. Properties that are not set by cmdlet parameters can be set by using the OtherAttributes

You must set the Name and Type parameters to create a new Active Directory object. The Name specifies the name of the new object. The Type parameter specifies the LDAP
display name of the Active Directory Schema Class that represents the type of object you want to create. Examples of Type values include computer, group, organizational
unit, and user.

The Path parameter specifies the container where the object will be created. When you do not specify the Path parameter, the cmdlet creates an object in the default naming
context container for Active Directory objects in the domain.

The following methods explain different ways to create an object by using this cmdlet.

Method 1: Use the New-ADObject cmdlet, specify the required parameters, and set any additional property values by using the cmdlet parameters.

Method 2: Use a template to create the new object. To do this, create a new Active Directory object or retrieve a copy of an existing Active Directory object and set the
Instance parameter to this object. The object provided to the Instance parameter is used as a template for the new object. You can override property values from the template
by setting cmdlet parameters. For more information, see the Instance parameter description for this cmdlet. For information about Active Directory cmdlets use the Instance
parameter, type Get-Help about_ActiveDirectory_Instance.

Method 3: Use the Import-CSV cmdlet with the New-ADObject cmdlet to create multiple Active Directory objects. To do this, use the Import-CSV cmdlet to create the custom
objects from a comma-separated value (CSV) file that contains a list of object properties. Then pass these objects through the pipeline to the New-ADObject cmdlet to create
the Active Directory objects.



Online Version: http://go.microsoft.com/fwlink/p/?linkid=291068




-------------------------- EXAMPLE 1 --------------------------

PS C:\>New-ADObject -Name '' -Type subnet -Description '' -OtherAttributes @{location="Building
A";siteObject="CN=HQ,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM"} -Path "CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM"

This command creates a subnet object in the HQ site with the described attributes.

-------------------------- EXAMPLE 2 --------------------------

PS C:\>$subnetTemplate = Get-ADObject -Identity "CN=,CN=Subnets,CN=Sites,CN=Configuration,DC=Fabrikam,DC=com" -properties description,location
PS C:\> New-ADObject -Instance $subnetTemplate -Name "" -Type subnet -Path "CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM"

This example creates a new subnet object, using a different subnet object as a template.

-------------------------- EXAMPLE 3 --------------------------

PS C:\>New-ADObject -Name SaraDavisContact -Type contact -ProtectedFromAccidentalDeletion $True -OtherAttributes

This command creates a new contact object, sets the msDS-SourceObjectDN property and protects the object from accidental deletion.

-------------------------- EXAMPLE 4 --------------------------

PS C:\>New-ADObject -name Apps -Type container -Path "DC=AppNC" -Server "FABRIKAM-SRV1:60000"

This command creates a new container object named Apps in an LDS instance.