Skip to content

Commit 861c0a4

Browse files
Update New-ADOrganizationalUnit.md
Added a short note about accidental protection. Changed two notes to follow Microsoft alert style. Fixed a cursive typo. Minor changes to follow markdown standards.
1 parent 6536e0a commit 861c0a4

File tree

1 file changed

+61
-29
lines changed

1 file changed

+61
-29
lines changed

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

Lines changed: 61 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ title: New-ADOrganizationalUnit
1111
# New-ADOrganizationalUnit
1212

1313
## SYNOPSIS
14+
1415
Creates an Active Directory organizational unit.
1516

1617
## SYNTAX
@@ -24,12 +25,13 @@ New-ADOrganizationalUnit [-WhatIf] [-Confirm] [-AuthType <ADAuthType>] [-City <S
2425
```
2526

2627
## DESCRIPTION
28+
2729
The **New-ADOrganizationalUnit** cmdlet creates an Active Directory organizational unit (OU).
2830
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.
31+
**Property** values that are not associated with cmdlet parameters can be set by using the *OtherAttributes* parameter.
3032

3133
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.
34+
If you do not specify the *Path* parameter, the cmdlet creates an OU under the default NC (Naming Context) head for the domain.
3335

3436
The following methods describe how to create an object by using this cmdlet.
3537

@@ -48,20 +50,23 @@ Then pass these objects through the pipeline to the **New-ADOrganizationalUnit**
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,11 +172,12 @@ 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

171183
You can also create a **PSCredential** object by using a script or by using the **Get-Credential** cmdlet.
@@ -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,24 @@ 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.
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.
346367
- 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.
368+
For example: in New-ADUser, the *Path* parameter defaults to the Users container.
369+
- 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.
349370

350371
In AD LDS environments, a default value for *Path* is set in the following cases:
351372

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.
373+
- 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.
353374
- If the cmdlet has a default path, this is used.
354-
For example: in New-ADUser, the *Path* parameter defaults to the Users container.
375+
For example: in New-ADUser, the *Path* parameter defaults to the Users container.
355376
- 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.
377+
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.
357378
- If none of the previous cases apply, the *Path* parameter does not take any default value.
358379

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.
380+
> [!NOTE]
381+
> The Active Directory Provider cmdlets, such as **New-Item**, **Remove-Item**, **Remove-ItemProperty**, **Rename-Item**, and **Set-ItemProperty**, also contain a **Path** property.
382+
>
383+
> However, for the Active Directory Provider cmdlets, the *Path* parameter identifies the path of the actual object rather than the container.
361384

362385
```yaml
363386
Type: String
@@ -372,9 +395,10 @@ Accept wildcard characters: False
372395
```
373396

374397
### -PostalCode
398+
375399
Specifies the postal code or zip code.
376400
This parameter sets the **PostalCode** property of an OU object.
377-
The LDAP display name (**ldapDisplayName**) of this property is postalCode.
401+
The LDAP display name (**ldapDisplayName**) of this property is `postalCode`.
378402

379403
```yaml
380404
Type: String
@@ -389,6 +413,7 @@ Accept wildcard characters: False
389413
```
390414

391415
### -ProtectedFromAccidentalDeletion
416+
392417
Indicates whether to prevent the object from being deleted.
393418
When this property is set to $True, you cannot delete the corresponding object without changing the value of the property.
394419
The acceptable values for this parameter are:
@@ -409,6 +434,7 @@ Accept wildcard characters: False
409434
```
410435

411436
### -Server
437+
412438
Specifies the AD DS instance to connect to, by providing one of the following values for a corresponding domain name or directory server.
413439
The service may be any of the following: AD LDS, AD DS, or Active Directory snapshot instance.
414440

@@ -444,9 +470,10 @@ Accept wildcard characters: False
444470
```
445471

446472
### -State
473+
447474
Specifies a state or province.
448475
This parameter sets the **State** property of an OU object.
449-
The LDAP display name (**ldapDisplayName**) of this property is st.
476+
The LDAP display name (**ldapDisplayName**) of this property is `st`.
450477

451478
```yaml
452479
Type: String
@@ -461,9 +488,10 @@ Accept wildcard characters: False
461488
```
462489

463490
### -StreetAddress
491+
464492
Specifies a street address.
465493
This parameter sets the **StreetAddress** property of an OU object.
466-
The LDAP display name (**ldapDisplayName**) of this property is street.
494+
The LDAP display name (**ldapDisplayName**) of this property is `street`.
467495

468496
```yaml
469497
Type: String
@@ -478,6 +506,7 @@ Accept wildcard characters: False
478506
```
479507

480508
### -WhatIf
509+
481510
Shows what would happen if the cmdlet runs.
482511
The cmdlet is not run.
483512

@@ -494,22 +523,26 @@ Accept wildcard characters: False
494523
```
495524

496525
### CommonParameters
526+
497527
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).
498528

499529
## INPUTS
500530

501531
### None or Microsoft.ActiveDirectory.Management.ADOrganizationalUnit
532+
502533
An OU object that is a template for the new OU object is received by the *Instance* parameter.
503534

504535
## OUTPUTS
505536

506537
### None or Microsoft.ActiveDirectory.Management.ADOrganizationalUnit
538+
507539
Returns the new OU object when the *PassThru* parameter is specified.
508540
By default, this cmdlet does not generate any output.
509541

510542
## NOTES
511-
* This cmdlet does not work with an Active Directory snapshot.
512-
* This cmdlet does not work with a read-only domain controller.
543+
544+
- This cmdlet does not work with an Active Directory snapshot.
545+
- This cmdlet does not work with a read-only domain controller.
513546

514547
## RELATED LINKS
515548

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

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

0 commit comments

Comments
 (0)