You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The **New-ADOrganizationalUnit** cmdlet creates an Active Directory organizational unit (OU).
28
29
You can set commonly used OU property values by using the cmdlet parameters.
29
-
**Property** values that are not associated with cmdlet parameters can be set by using the*OtherAttributes* parameter.
30
+
**Property** values that are not associated with cmdlet parameters can be set by using the*OtherAttributes* parameter.
30
31
31
32
You must set the *Name* parameter to create a new OU.
32
-
If you do not specify the *Path* parameter, the cmdlet creates an OU under the default NC head for the domain.
33
+
If you do not specify the *Path* parameter, the cmdlet creates an OU under the default naming context (NC) head for the domain.
33
34
34
35
The following methods describe how to create an object by using this cmdlet.
35
36
@@ -42,26 +43,30 @@ You can override property values from the template by setting cmdlet parameters.
42
43
For more information, see the *Instance* parameter description for this cmdlet.
43
44
44
45
Method 3: Use the **Import-Csv** cmdlet with the **New-ADOrganizationalUnit** cmdlet to create multiple Active Directory OU objects.
45
-
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.
46
+
To do this, use the [**Import-Csv**](/powershell/module/microsoft.powershell.utility/import-csv) cmdlet to create the custom objects
47
+
from a comma-separated value (CSV) file that contains a list of object properties.
46
48
Then pass these objects through the pipeline to the **New-ADOrganizationalUnit** cmdlet to create the OU objects.
Specifies the user account credentials to use to perform this task.
165
177
The default credentials are the credentials of the currently logged on user unless the cmdlet is run from an Active Directory PowerShell provider drive.
166
178
If the cmdlet is run from such a provider drive, the account associated with the drive is the default.
167
179
168
-
To specify this parameter, you can type a user name, such as User1 or Domain01\User01 or you can specify a **PSCredential** object.
180
+
To specify this parameter, you can type a user name, such as `User1` or `Domain01\User01` or you can specify a **PSCredential** object.
169
181
If you specify a user name for this parameter, the cmdlet prompts for a password.
170
182
171
-
You can also create a **PSCredential** object by using a script or by using the **Get-Credential** cmdlet.
183
+
You can also create a **PSCredential** object by using a script or by using the [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential?view=powershell-7.3) cmdlet.
172
184
You can then set the *Credential* parameter to the **PSCredential** object.
173
185
174
186
If the acting credentials do not have directory-level permission to perform the task, Active Directory PowerShell returns a terminating error.
Specifies an instance of an OU object to use as a template for a new OU object.
224
239
225
240
You can use an instance of an existing OU object as a template or you can construct a new OU object by using the Windows PowerShell command line or by using a script.
@@ -232,7 +247,8 @@ You can override property values of the new object by setting the appropriate pa
232
247
Method 2: Create a new **ADOrganizationalUnit** object and set the property values by using the Windows PowerShell command line interface.
233
248
Then pass this object to the *Instance* parameter of the **New-ADOrganizationalUnit** cmdlet to create the new Active Directory OU object.
234
249
235
-
Note: Specified attributes are not validated, so attempting to set attributes that do not exist or cannot be set raises an error.
250
+
> [!NOTE]
251
+
> Specified attributes are not validated, so attempting to set attributes that do not exist or cannot be set raises an error.
Specifies the X.500 path of the OU or container where the new object is created.
338
359
339
360
In many cases, a default value is used for the *Path* parameter if no value is specified.
@@ -342,22 +363,22 @@ Note that rules listed first are evaluated first and when a default value can be
342
363
343
364
In Active Directory Domain Services (AD DS) environments, a default value for *Path* is set in the following cases:
344
365
345
-
- If the cmdlet is run from an Active Directory PowerShell provider drive, the parameter is set to the current path of the provider drive.
346
-
- If the cmdlet has a default path, this is used.
347
-
For example: in New-ADUser, the *Path* parameter defaults to the Users container.
348
-
- If none of the previous cases apply, the default value of *Path* is set to the default partition or naming context of the target domain.
366
+
- If the cmdlet is run from an Active Directory PowerShell provider drive, the parameter is set to the current path of the provider drive.
367
+
- If the cmdlet has a default path, this is used. For example: in **New-ADUser**, the *Path* parameter defaults to the Users container.
368
+
- If none of the previous cases apply, the default value of *Path* is set to the default partition or naming context of the target domain.
349
369
350
-
In AD LDS environments, a default value for *Path* is set in the following cases:
370
+
In AD LDS environments, a default value for *Path* is set in the following cases:
351
371
352
-
- If the cmdlet is run from an Active Directory module for PowerShell provider drive, the parameter is set to the current path of the provider drive.
353
-
- If the cmdlet has a default path, this is used.
354
-
For example: in New-ADUser, the *Path* parameter defaults to the Users container.
372
+
- If the cmdlet is run from an Active Directory module for PowerShell provider drive, the parameter is set to the current path of the provider drive.
373
+
- If the cmdlet has a default path, this is used. For example: in **New-ADUser**, the *Path* parameter defaults to the Users container.
355
374
- If the target AD LDS instance has a default naming context, the default value of *Path* is set to the default naming context.
356
-
To specify a default naming context for an AD LDS environment, set the **msDS-defaultNamingContext** property of the Active Directory directory service agent object (**nTDSDSA**) for the AD LDS instance.
375
+
To specify a default naming context for an AD LDS environment, set the **msDS-defaultNamingContext** property of the Active Directory directory service agent object (**nTDSDSA**) for the AD LDS instance.
357
376
- If none of the previous cases apply, the *Path* parameter does not take any default value.
358
377
359
-
Note: The Active Directory Provider cmdlets, such as **New-Item**, **Remove-Item**, **Remove-ItemProperty**, **Rename-Item**, and **Set-ItemProperty**, also contain a **Path** property.
360
-
However, for the Active Directory Provider cmdlets, the *Path* parameter identifies the path of the actual object rather than the container.
378
+
> [!NOTE]
379
+
> The Active Directory Provider cmdlets, such as **New-Item**, **Remove-Item**, **Remove-ItemProperty**, **Rename-Item**, and **Set-ItemProperty**, also contain a **Path** property.
380
+
>
381
+
> However, for the Active Directory Provider cmdlets, the *Path* parameter identifies the path of the actual object rather than the container.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
498
526
499
527
## INPUTS
500
528
501
529
### None or Microsoft.ActiveDirectory.Management.ADOrganizationalUnit
530
+
502
531
An OU object that is a template for the new OU object is received by the *Instance* parameter.
503
532
504
533
## OUTPUTS
505
534
506
535
### None or Microsoft.ActiveDirectory.Management.ADOrganizationalUnit
536
+
507
537
Returns the new OU object when the *PassThru* parameter is specified.
508
538
By default, this cmdlet does not generate any output.
509
539
510
540
## NOTES
541
+
511
542
* This cmdlet does not work with an Active Directory snapshot.
512
543
* This cmdlet does not work with a read-only domain controller.
513
544
@@ -518,4 +549,3 @@ By default, this cmdlet does not generate any output.
0 commit comments