PowerShell Logo Small

New-ADObject



This is the built-in help made by Microsoft for the command 'New-ADObject', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 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.

SYNOPSIS

Creates an Active Directory object.

SYNTAX


New-ADObject [-Name] <String> [-Type] <String> [-AuthType <ADAuthType>] [-Credential <PSCredential>] [-Description <String>] [-DisplayName
<String>] [-Instance <ADObject>] [-OtherAttributes <Hashtable>] [-PassThru [<SwitchParameter>]] [-Path <String>]
[-ProtectedFromAccidentalDeletion <Boolean>] [-Server <String>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


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


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 examples and more information, see the
Instance parameter description for this cmdlet. For information about Active Directory cmdlets use the Instance parameter, see
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.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=219323
Get-ADObject
Move-ADObject
Remove-ADObject
Rename-ADObject
Restore-ADObject
Set-ADObject

REMARKS

<

Examples


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

C:\PS>New-ADObject -Name '192.168.1.0/26' -Type subnet -Description '192.168.1.0/255.255.255.192' -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"



Description

-----------

Creates a subnet object in the HQ site with the described attributes.




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

C:\PS>$subnetTemplate = get-adobject -Identity "CN=192.168.1.0/26,CN=Subnets,CN=Sites,CN=Configuration,DC=Fabrikam,DC=com" -properties
description,location; new-adobject -instance $subnetTemplate -name "192.168.1.0/28" -type subnet -path
"CN=Subnets,CN=Sites,CN=Configuration,DC=FABRIKAM,DC=COM"



Description

-----------

Creates a new subnet object, using a different subnet object as a template




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

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



Description

-----------

Creates a new contact object, sets the msDS-SourceObjectDN property and protects the object from accidental deletion




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

C:\PS>new-adobject -name Apps -type container -path "DC=AppNC" -server "FABRIKAM-SRV1:60000"



Description

-----------

Creates a new container object named 'Apps' in an LDS instance.