Create an AD object.

      New-ADObject [-Name] string [-Type] string
         [-AuthType {Negotiate | Basic}] [-Credential PSCredential]
            [-Description string] [-DisplayName string]
               [-Instance ADObject] [-OtherAttributes hashtable]
                  [-PassThru] [-Path string] [-ProtectedFromAccidentalDeletion bool]
                     [-Server string] [-Confirm] [-WhatIf] [CommonParameters]

   -AuthType {Negotiate | Basic}
       The authentication method to use: Negotiate (or 0), Basic (or 1)
       A Secure Sockets Layer (SSL) connection is required for Basic authentication.

   -Credential PSCredential
       The user account credentials to use to perform this task.
       The default credentials are those of the currently logged on user unless the
       cmdlet is run from an Active Directory PowerShell provider drive.
       If the cmdlet is run from such a provider drive, the account associated with the drive is the default.

       Type a user name, such as "User64" or "Domain64\User64" or specify a
       PSCredential object such as one generated by Get-Credential 

       If a user name is specified, the cmdlet will prompt for a password.

   -Description string
       A description of the object.

   -DisplayName string
       The display name of the object.

   -Instance ADObject
       An instance of an object to use as a template for a new AD object.

       Use an instance of an existing AD object as a template or construct a
       new group object by using the PowerShell command line or by using a script.

       The following examples show how to use these two methods:

       Method 1: Use the Get-ADObject cmdlet and then override property values of
       the new object by setting the appropriate parameters. 

          $ObjectInstance = Get-ADObject -Identity "Desktop001" 
          New-ADObject -Name "Desktop002" -Instance $ObjectInstance -Type "computer"

       Method 2: Use the New-Object cmdlet and pass the object to the New-ADObject cmdlet.

          $objectInstance = New-Object Microsoft.ActiveDirectory.Management.ADObject
          $objectInstance.Description = "Desktop002 Computer"
          New-ADObject -Name Desktop002  -Instance $ObjectInstance -Type computer

       Note: Specified attributes are not validated, so attempting to set attributes that
             do not exist or cannot be set will raise an error.

   -Name string
       The name of the object.

   -OtherAttributes hashtable
       Object attribute values for attributes that are not represented by cmdlet parameters.
       Set one or more parameters at the same time with this parameter.
       If an attribute takes more than one value, you can assign multiple values.
       To identify an attribute, specify the LDAP provider Name (ldapDisplayName) defined for it in
       the Active Directory schema.

        To specify a single value for an attribute:
           -OtherAttributes @{'AttributeLDAPName'=value}
        To specify multiple values for an attribute
           -OtherAttributes @{'AttributeLDAPName'=value1,value2,...}

        Specify values for more than one attribute by using semicolons to separate attributes.
        To set values for multiple attributes:
           -OtherAttributes @{'Attribute1DisplayName'=value; 'Attribute2LDAPName'=value1,value2;...}

        The following examples show how to use this parameter.

        To set the value of a custom attribute called favColors that takes a set of Unicode strings: 
           -OtherAttributes @{'favColors'="pink","purple"}

        To set values for favColors and dateOfBirth simultaneously, use the following syntax:
           -OtherAttributes @{'favColors'="pink","purple"; 'dateOfBirth'=" 01/01/1960"}

   -PassThru switch
       Return the new or modified object.
       By default (i.e. if -PassThru is not specified), this cmdlet does not generate any output.
   -Path string
       The X.500 path of the Organizational Unit (OU) or container where the new object is created.  

       In many cases, a default value will be used for -Path if no value is specified.

       Note:  The PowerShell cmdlets, such New-Item, Remove-Item, Remove-ItemProperty, Rename-Item and 
       Set-ItemProperty also contain a Path property. However, for the AD provider cmdlets, the -Path parameter 
       identifies the path of the actual object and not the container.

   -ProtectedFromAccidentalDeletion bool
       When this property is true, you cannot delete the corresponding object without
       first resetting the value of this property.
       Values: $true (or 1), $false (or 0)

-Server string The AD Domain Services instance to connect to, this may be a Fully qualified domain name, NetBIOS name, Fully qualified directory server name (with or without port number) -Type string The type of object to create. Set the Type parameter to the LDAP provider name of the AD Schema Class that represents the type of object to be created. Examples: -type user, -type computer, -type group. -Confirm Prompt for confirmation before executing the command. -WhatIf Describe what would happen if you executed the command without actually executing the command.

New-ADObject creates a new AD object such as a new organizational unit or new user account. Use this cmdlet to create any type of AD 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 parameter.

The -Name and -Type parameters are required to create a new AD object. The Name specifies the name of the new object. The Type parameter specifies the LDAP provider 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.

There are 3 different ways to create an object using New-ADObject:

Method 1: Use New-ADObject, specifing the required parameters.

Method 2: Use a template to create the new object. Create or retrieve a copy of an existing AD 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.

Method 3: Use Import-CSV with the New-ADObject cmdlet to create multiple AD objects. Use Import-CSV to create custom objects from a CSV file that contains a list of object properties. Then pass the objects through the pipeline to New-ADObject.


Creates a subnet object in the Aberdeen site with the described attributes:

PS C:\> New-ADObject -Name '' -Type subnet -Description '' -OtherAttributes @{location="West Tullos";siteObject="CN=Aberdeen,CN=Sites,CN=Configuration,DC=SS64,DC=COM"} -Path "CN=Subnets,CN=Sites ,CN=Configuration,DC=SS64,DC=COM"

Create a new subnet object, using an existing subnet object as a template:

PS C:\> $subnetTemplate = get-adobject -Identity "CN=,CN=Subnets,CN=Sites,CN=Configuration,DC=SS64,
DC=com" -properties description,location

PS C:\> new-adobject -instance $subnetTemplate -name "" -type subnet -path "CN=Subnets,CN=Sites,CN=Configuration,DC=SS64,DC=COM"

Create a new contact object, set the msDS-SourceObjectDN property and protect the object from accidental deletion:

PS C:\> New-ADObject -name SaraDavisContact -type contact -ProtectedFromAccidentalDeletion $true -OtherAttributes @{'msDS-SourceObjectDN'="CN=SS64Contacts,DC=SS64,DC=COM"}

“Works of art, in my opinion, are the only objects in the material universe to possess internal order, and that is why, though I don't believe that only art matters, I do believe in Art for Art's sake” ~ E. M. Forster

Related PowerShell Cmdlets:

Get-adObject - Get one or more AD objects.
Move-adObject - Move an AD object or container to a different container or domain.
Remove-adObject - Remove an AD object.
Rename-adObject - Change the name of an AD object.
Restore-adObject - Restore an AD object.
Set-adObject - Modify an AD object.

Copyright © 1999-2021
Some rights reserved