Skip to content

Commit 4eb7468

Browse files
Update New-ADOrganizationalUnit.md
Added change from PR MicrosoftDocs#3661. Closes MicrosoftDocs#3661
1 parent 217c196 commit 4eb7468

File tree

1 file changed

+64
-34
lines changed

1 file changed

+64
-34
lines changed

docset/winserver2016-ps/activedirectory/New-ADOrganizationalUnit.md

Lines changed: 64 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ New-ADOrganizationalUnit [-WhatIf] [-Confirm] [-AuthType <ADAuthType>] [-City <S
2424
```
2525

2626
## DESCRIPTION
27+
2728
The **New-ADOrganizationalUnit** cmdlet creates an Active Directory organizational unit (OU).
2829
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.
3031

3132
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.
3334

3435
The following methods describe how to create an object by using this cmdlet.
3536

@@ -42,26 +43,30 @@ You can override property values from the template by setting cmdlet parameters.
4243
For more information, see the *Instance* parameter description for this cmdlet.
4344

4445
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.
4648
Then pass these objects through the pipeline to the **New-ADOrganizationalUnit** cmdlet to create the OU objects.
4749

4850
## EXAMPLES
4951

5052
### Example 1: Create an OU
53+
5154
```
5255
PS C:\> New-ADOrganizationalUnit -Name "UserAccounts" -Path "DC=FABRIKAM,DC=COM"
5356
```
5457

55-
This command creates an OU named UserAccounts that is protected from accidental deletion.
58+
This command creates an OU named UserAccounts that is protected from accidental deletion. Note that accidental protection is implicit.
5659

5760
### Example 2: Create an OU that is not protected from accidental deletion
61+
5862
```
5963
PS C:\> New-ADOrganizationalUnit -Name "UserAccounts" -Path "DC=FABRIKAM,DC=COM" -ProtectedFromAccidentalDeletion $False
6064
```
6165

6266
This command creates an OU named UserAccounts that is not protected from accidental deletion.
6367

6468
### Example 3: Create an OU that is protected from accidental deletion
69+
6570
```
6671
PS C:\> New-ADOrganizationalUnit -Name "UserAccounts" -Path "DC=FABRIKAM,DC=COM" -OtherAttributes @{seeAlso="CN=HumanResourceManagers,OU=Groups,OU=Managed,DC=Fabrikam,DC=com";managedBy="CN=TomC,DC=FABRIKAM,DC=COM"}
6772
```
@@ -70,6 +75,7 @@ This command creates an OU named UserAccounts that is protected from accidental
7075
The **seeAlso** and **managedBy** properties are set to specified values.
7176

7277
### Example 4: Create an OU from a template OU
78+
7379
```
7480
PS C:\> $OuTemplate = Get-ADOrganizationalUnit -Identity "OU=UserAccounts,DC=Fabrikam,DC=com" -Properties seeAlso,managedBy
7581
PS C:\> New-ADOrganizationalUnit -Name "TomCReports" -Instance $OuTemplate
@@ -78,6 +84,7 @@ PS C:\> New-ADOrganizationalUnit -Name "TomCReports" -Instance $OuTemplate
7884
This command uses the data from the OU OU=UserAccounts,DC=Fabrikam,DC=com as a template for another OU.
7985

8086
### Example 5: Create an OU in an AD LDS instance
87+
8188
```
8289
PS C:\> New-ADOrganizationalUnit -Name "Managed" -Path "DC=AppNC" -Server "FABRIKAM-SRV1:60000"
8390
```
@@ -87,6 +94,7 @@ This command creates an OU named Managed in an AD LDS instance.
8794
## PARAMETERS
8895

8996
### -AuthType
97+
9098
Specifies the authentication method to use.
9199
The acceptable values for this parameter are:
92100

@@ -111,9 +119,10 @@ Accept wildcard characters: False
111119
```
112120
113121
### -City
122+
114123
Specifies the town or city.
115124
This parameter sets the **City** property of an OU object.
116-
The Lightweight Directory Access Protocol (LDAP) display name (**ldapDisplayName**) of this property is l.
125+
The Lightweight Directory Access Protocol (LDAP) display name (**ldapDisplayName**) of this property is `l`.
117126

118127
```yaml
119128
Type: String
@@ -128,6 +137,7 @@ Accept wildcard characters: False
128137
```
129138

130139
### -Confirm
140+
131141
Prompts you for confirmation before running the cmdlet.
132142

133143
```yaml
@@ -143,9 +153,10 @@ Accept wildcard characters: False
143153
```
144154

145155
### -Country
156+
146157
Specifies the country or region code.
147158
This parameter sets the **Country** property of an OU object.
148-
The LDAP display name (**ldapDisplayName**) of this property is c.
159+
The LDAP display name (**ldapDisplayName**) of this property is `c`.
149160
This value is not used by Windows 2000.
150161

151162
```yaml
@@ -161,14 +172,15 @@ Accept wildcard characters: False
161172
```
162173

163174
### -Credential
175+
164176
Specifies the user account credentials to use to perform this task.
165177
The default credentials are the credentials of the currently logged on user unless the cmdlet is run from an Active Directory PowerShell provider drive.
166178
If the cmdlet is run from such a provider drive, the account associated with the drive is the default.
167179

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.
169181
If you specify a user name for this parameter, the cmdlet prompts for a password.
170182

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.
172184
You can then set the *Credential* parameter to the **PSCredential** object.
173185

174186
If the acting credentials do not have directory-level permission to perform the task, Active Directory PowerShell returns a terminating error.
@@ -186,9 +198,10 @@ Accept wildcard characters: False
186198
```
187199

188200
### -Description
201+
189202
Specifies a description of the object.
190203
This parameter sets the value of the **Description** property for the OU object.
191-
The LDAP display name (**ldapDisplayName**) for this property is description.
204+
The LDAP display name (**ldapDisplayName**) for this property is `description`.
192205

193206
```yaml
194207
Type: String
@@ -203,9 +216,10 @@ Accept wildcard characters: False
203216
```
204217

205218
### -DisplayName
219+
206220
Specifies the display name of the object.
207221
This parameter sets the **DisplayName** property of the OU object.
208-
The LDAP display name (**ldapDisplayName**) for this property is displayName.
222+
The LDAP display name (**ldapDisplayName**) for this property is `displayName`.
209223

210224
```yaml
211225
Type: String
@@ -220,6 +234,7 @@ Accept wildcard characters: False
220234
```
221235

222236
### -Instance
237+
223238
Specifies an instance of an OU object to use as a template for a new OU object.
224239

225240
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
232247
Method 2: Create a new **ADOrganizationalUnit** object and set the property values by using the Windows PowerShell command line interface.
233248
Then pass this object to the *Instance* parameter of the **New-ADOrganizationalUnit** cmdlet to create the new Active Directory OU object.
234249

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

237253
```yaml
238254
Type: ADOrganizationalUnit
@@ -247,16 +263,17 @@ Accept wildcard characters: False
247263
```
248264

249265
### -ManagedBy
266+
250267
Specifies the user or group that manages the object by providing one of the following property values.
251268
Note: The identifier in parentheses is the LDAP display name for the property.
252269
The acceptable values for this parameter are:
253270

254271
- A distinguished name
255-
- A GUID (objectGUID)
256-
- A security identifier (objectSid)
272+
- A GUID (objectGUID)
273+
- A security identifier (objectSid)
257274
- A SAM account name (sAMAccountName)
258275

259-
This parameter sets the Active Directory attribute with an LDAP display name of managedBy.
276+
This parameter sets the Active Directory attribute with an LDAP display name of `managedBy`.
260277

261278
```yaml
262279
Type: ADPrincipal
@@ -271,9 +288,10 @@ Accept wildcard characters: False
271288
```
272289

273290
### -Name
291+
274292
Specifies the name of the object.
275293
This parameter sets the **Name** property of the OU object.
276-
The LDAP display name (**ldapDisplayName**) of this property is name.
294+
The LDAP display name (**ldapDisplayName**) of this property is `name`.
277295

278296
```yaml
279297
Type: String
@@ -288,6 +306,7 @@ Accept wildcard characters: False
288306
```
289307

290308
### -OtherAttributes
309+
291310
Specifies object attribute values for attributes that are not represented by cmdlet parameters.
292311
You can set one or more parameters at the same time with this parameter.
293312
If an attribute takes more than one value, you can assign multiple values.
@@ -297,11 +316,11 @@ To specify a single value for an attribute:
297316

298317
`-OtherAttributes @{'AttributeLDAPDisplayName'=value}`
299318

300-
To specify multiple values for an attribute:
319+
To specify multiple values for an attribute, separate the values with a comma:
301320

302321
`-OtherAttributes @{'AttributeLDAPDisplayName'=value1,value2,...}`
303322

304-
To specify values for multiple attributes:
323+
To specify values for multiple attributes, separate the attributes with a semi-colon:
305324

306325
`-OtherAttributes @{'Attribute1LDAPDisplayName'=value; 'Attribute2LDAPDisplayName'=value1,value2;...}`
307326

@@ -318,6 +337,7 @@ Accept wildcard characters: False
318337
```
319338

320339
### -PassThru
340+
321341
Returns an object representing the item with which you are working.
322342
By default, this cmdlet does not generate any output.
323343

@@ -334,6 +354,7 @@ Accept wildcard characters: False
334354
```
335355

336356
### -Path
357+
337358
Specifies the X.500 path of the OU or container where the new object is created.
338359

339360
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
342363

343364
In Active Directory Domain Services (AD DS) environments, a default value for *Path* is set in the following cases:
344365

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

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:
351371

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.
355374
- 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.
357376
- If none of the previous cases apply, the *Path* parameter does not take any default value.
358377

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

362383
```yaml
363384
Type: String
@@ -372,9 +393,10 @@ Accept wildcard characters: False
372393
```
373394

374395
### -PostalCode
396+
375397
Specifies the postal code or zip code.
376398
This parameter sets the **PostalCode** property of an OU object.
377-
The LDAP display name (**ldapDisplayName**) of this property is postalCode.
399+
The LDAP display name (**ldapDisplayName**) of this property is `postalCode`.
378400

379401
```yaml
380402
Type: String
@@ -389,6 +411,7 @@ Accept wildcard characters: False
389411
```
390412

391413
### -ProtectedFromAccidentalDeletion
414+
392415
Indicates whether to prevent the object from being deleted.
393416
When this property is set to $True, you cannot delete the corresponding object without changing the value of the property.
394417
The acceptable values for this parameter are:
@@ -409,17 +432,18 @@ Accept wildcard characters: False
409432
```
410433

411434
### -Server
435+
412436
Specifies the AD DS instance to connect to, by providing one of the following values for a corresponding domain name or directory server.
413437
The service may be any of the following: AD LDS, AD DS, or Active Directory snapshot instance.
414438

415-
Specify the AD DS instance in one of the following ways:
439+
Specify the AD DS instance in one of the following ways:
416440

417441
Domain name values:
418442

419443
- Fully qualified domain name
420444
- NetBIOS name
421445

422-
Directory server values:
446+
Directory server values:
423447

424448
- Fully qualified directory server name
425449
- NetBIOS name
@@ -444,9 +468,10 @@ Accept wildcard characters: False
444468
```
445469

446470
### -State
471+
447472
Specifies a state or province.
448473
This parameter sets the **State** property of an OU object.
449-
The LDAP display name (**ldapDisplayName**) of this property is st.
474+
The LDAP display name (**ldapDisplayName**) of this property is `st`.
450475

451476
```yaml
452477
Type: String
@@ -461,9 +486,10 @@ Accept wildcard characters: False
461486
```
462487

463488
### -StreetAddress
489+
464490
Specifies a street address.
465491
This parameter sets the **StreetAddress** property of an OU object.
466-
The LDAP display name (**ldapDisplayName**) of this property is street.
492+
The LDAP display name (**ldapDisplayName**) of this property is `street`.
467493

468494
```yaml
469495
Type: String
@@ -478,6 +504,7 @@ Accept wildcard characters: False
478504
```
479505

480506
### -WhatIf
507+
481508
Shows what would happen if the cmdlet runs.
482509
The cmdlet is not run.
483510

@@ -494,20 +521,24 @@ Accept wildcard characters: False
494521
```
495522

496523
### CommonParameters
524+
497525
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).
498526

499527
## INPUTS
500528

501529
### None or Microsoft.ActiveDirectory.Management.ADOrganizationalUnit
530+
502531
An OU object that is a template for the new OU object is received by the *Instance* parameter.
503532

504533
## OUTPUTS
505534

506535
### None or Microsoft.ActiveDirectory.Management.ADOrganizationalUnit
536+
507537
Returns the new OU object when the *PassThru* parameter is specified.
508538
By default, this cmdlet does not generate any output.
509539

510540
## NOTES
541+
511542
* This cmdlet does not work with an Active Directory snapshot.
512543
* This cmdlet does not work with a read-only domain controller.
513544

@@ -518,4 +549,3 @@ By default, this cmdlet does not generate any output.
518549
[Remove-ADOrganizationalUnit](./Remove-ADOrganizationalUnit.md)
519550

520551
[Set-ADOrganizationalUnit](./Set-ADOrganizationalUnit.md)
521-

0 commit comments

Comments
 (0)