Skip to content

Commit a9d4ae2

Browse files
Apply suggestions from code review
Co-authored-by: Mikey Lombardi (He/Him) <[email protected]>
1 parent 6650427 commit a9d4ae2

File tree

1 file changed

+85
-76
lines changed

1 file changed

+85
-76
lines changed

docset/winserver2022-ps/activedirectory/Set-ADUser.md

+85-76
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ Set-ADUser [-WhatIf] [-Confirm] [-AuthType <ADAuthType>] [-Credential <PSCredent
4848

4949
## DESCRIPTION
5050

51-
The **Set-ADUser** cmdlet modifies the properties of an Active Directory user.
52-
You can modify commonly used property values by using the cmdlet parameters.
53-
You can set property values that are not associated with cmdlet parameters by using the *Add*, *Remove*, *Replace*, and *Clear* parameters.
51+
The `Set-ADUser` cmdlet modifies the properties of an Active Directory user. You can modify
52+
commonly used property values by using the cmdlet parameters. You can set property values that are
53+
not associated with cmdlet parameters by using the **Add**, **Remove**, **Replace**, and **Clear**
54+
parameters.
5455

5556
The *Identity* parameter specifies the Active Directory user to modify.
5657
You can identify a user by its distinguished name, GUID, security identifier (SID), or Security Account Manager (SAM) account name.
@@ -76,7 +77,12 @@ To specify a default naming context for an AD LDS environment, set the **msDS-de
7677
### Example 1: Set properties for a user
7778

7879
```powershell
79-
PS C:\> Set-ADUser -Identity ChewDavid -HomePage 'http://fabrikam.com/employees/ChewDavid' -LogonWorkstations 'ChewDavid-DSKTOP,ChewDavid-LPTOP'
80+
$params = @{
81+
Identity = 'ChewDavid'
82+
HomePage = 'http://fabrikam.com/employees/ChewDavid'
83+
LogonWorkstations = 'ChewDavid-DSKTOP,ChewDavid-LPTOP'
84+
}
85+
Set-ADUser @params
8086
```
8187

8288
This command sets the specified user's **homepage** property to http://fabrikam.com/employees/ChewDavid and the **LogonWorkstations** property to ChewDavid-DSKTOP,ChewDavid-LPTOP.
@@ -444,8 +450,8 @@ specifying a comma-separated list. The format for this parameter is:
444450

445451
`-Clear Attribute1LDAPDisplayName, Attribute2LDAPDisplayName`
446452

447-
When you use the *Add*, *Remove*, *Replace*, and *Clear* parameters together, the operations are
448-
performed in the following order:
453+
When you use the **Add**, **Remove**, **Replace**, and **Clear** parameters together, the
454+
operations are performed in the following order:
449455

450456
- **Remove**
451457
- **Add**
@@ -491,10 +497,11 @@ for the user's device. This value sets the compound identity supported flag of t
491497
- $False or 0
492498
- $True or 1
493499

494-
Warning: Domain-joined Windows systems and services such as clustering manage their own
495-
**msDS-SupportedEncryptionTypes** attribute. Therefore any changes to the flag on the
496-
**msDS-SupportedEncryptionTypes** attribute are overwritten by the service or system that manages
497-
the setting.
500+
> [!WARNING]
501+
> Domain-joined Windows systems and services such as clustering manage their own
502+
> **msDS-SupportedEncryptionTypes** attribute. Therefore any changes to the flag on the
503+
> **msDS-SupportedEncryptionTypes** attribute are overwritten by the service or system that manages
504+
> the setting.
498505

499506
```yaml
500507
Type: Boolean
@@ -553,8 +560,8 @@ with the drive is the default.
553560
To specify this parameter, you can type a user name, such as `User1` or `Domain01\User01` or you can specify a **PSCredential** object.
554561
If you specify a user name for this parameter, the cmdlet prompts for a password.
555562

556-
You can also create a **PSCredential** object by using a script or by using the Get-Credential
557-
cmdlet. You can then set the _Credential_ parameter to the **PSCredential** object.
563+
You can also create a **PSCredential** object by using a script or by using the `Get-Credential`
564+
cmdlet. You can then set the **Credential** parameter to the **PSCredential** object.
558565

559566
If the acting credentials do not have directory-level permission to perform the task, Active
560567
Directory PowerShell returns a terminating error.
@@ -836,9 +843,9 @@ The identifier in parentheses is the LDAP display name for the attribute.
836843
The acceptable values for this parameter are:
837844

838845
- A distinguished name
839-
- A GUID (objectGUID)
840-
- A security identifier (objectSid)
841-
- A SAM account name (sAMAccountName)
846+
- A GUID (**objectGUID**)
847+
- A security identifier (**objectSid**)
848+
- A SAM account name (**sAMAccountName**)
842849

843850
The cmdlet searches the default naming context or partition to find the object.
844851
If two or more objects are found, the cmdlet returns a non-terminating error.
@@ -884,9 +891,9 @@ modified and the set of changes that should be made to that object. When this pa
884891
specified, any modifications made to the **ADUser** object are also made to the corresponding Active
885892
Directory object. The cmdlet only updates the object properties that have changed.
886893

887-
The **ADUser** object specified as the value of the _Instance_ parameter must have been retrieved by
888-
using the **Get-ADUser** cmdlet. When you specify the _Instance_ parameter, you cannot specify other
889-
parameters that set individual properties on the object.
894+
The **ADUser** object specified as the value of the **Instance** parameter must have been retrieved
895+
by using the `Get-ADUser` cmdlet. When you specify the **Instance** parameter, you cannot specify
896+
other parameters that set individual properties on the object.
890897

891898
```yaml
892899
Type: ADUser
@@ -906,22 +913,23 @@ Specifies whether an account supports Kerberos encryption types which are used d
906913
service tickets. This value sets the encryption types supported flags of the Active Directory
907914
**msDS-SupportedEncryptionTypes** attribute. The acceptable values for this parameter are:
908915

909-
- None
910-
- DES
911-
- RC4
912-
- AES128
913-
- AES256
916+
- `None`
917+
- `DES`
918+
- `RC4`
919+
- `AES128`
920+
- `AES256`
914921

915-
None removes all encryption types from the account, resulting in the KDC being unable to issue
922+
`None` removes all encryption types from the account, resulting in the KDC being unable to issue
916923
service tickets for services using the account.
917924

918925
DES is a weak encryption type that is not supported by default since Windows 7 and Windows Server
919926
2008 R2.
920927

921-
Warning: Domain-joined Windows systems and services such as clustering manage their own
922-
**msDS-SupportedEncryptionTypes** attribute. Therefore any changes to the flag on the
923-
**msDS-SupportedEncryptionTypes** attribute are overwritten by the service or system that manages
924-
the setting.
928+
> [!WARNING]
929+
> Domain-joined Windows systems and services such as clustering manage their own
930+
> **msDS-SupportedEncryptionTypes** attribute. Therefore any changes to the flag on the
931+
> **msDS-SupportedEncryptionTypes** attribute are overwritten by the service or system that manages
932+
> the setting.
925933

926934
```yaml
927935
Type: ADKerberosEncryptionType
@@ -938,10 +946,10 @@ Accept wildcard characters: False
938946

939947
### -LogonWorkstations
940948

941-
Specifies the computers that the user can access. To specify more than one computer, create a single
942-
comma-separated list. You can identify a computer by using the Security Account Manager (SAM)
943-
account name (sAMAccountName) or the DNS host name of the computer. The SAM account name is the same
944-
as the NetBIOS name of the computer.
949+
Specifies the computers that the user can access. To specify more than one computer, create a
950+
single comma-separated list. You can identify a computer by using the Security Account Manager
951+
(SAM) account name (**sAMAccountName**) or the DNS host name of the computer. The SAM account name
952+
is the same as the NetBIOS name of the computer.
945953

946954
The LDAP display name (**ldapDisplayName**) for this property is userWorkStations.
947955

@@ -966,9 +974,9 @@ Note: The identifier in parentheses is the LDAP display name for the property.
966974
The acceptable values for this parameter are:
967975

968976
- A distinguished name
969-
- A GUID (objectGUID)
970-
- A security identifier (objectSid)
971-
- A SAM account name (sAMAccountName)
977+
- A GUID (**objectGUID**)
978+
- A security identifier (**objectSid**)
979+
- A SAM account name (**sAMAccountName**)
972980

973981
The LDAP display name (**ldapDisplayName**) of this property is manager.
974982

@@ -1078,32 +1086,32 @@ Accept wildcard characters: False
10781086

10791087
Specifies the distinguished name of an Active Directory partition.
10801088
The distinguished name must be one of the naming contexts on the current directory server.
1081-
The cmdlet searches this partition to find the object defined by the _Identity_ parameter.
1089+
The cmdlet searches this partition to find the object defined by the **Identity** parameter.
10821090

1083-
In many cases, a default value is used for the _Partition_ parameter if no value is specified. The
1084-
rules for determining the default value are given below. Note that rules listed first are evaluated
1085-
first and when a default value can be determined, no further rules are evaluated.
1091+
In many cases, a default value is used for the **Partition** parameter if no value is specified.
1092+
The rules for determining the default value are given below. Note that rules listed first are
1093+
evaluated first and when a default value can be determined, no further rules are evaluated.
10861094

1087-
In AD DS environments, a default value for _Partition_ are set in the following cases:
1095+
In AD DS environments, a default value for **Partition** are set in the following cases:
10881096

1089-
- If the _Identity_ parameter is set to a distinguished name, the default value of _Partition_ is
1090-
automatically generated from this distinguished name.
1091-
- If running cmdlets from an Active Directory provider drive, the default value of _Partition_ is
1097+
- If the **Identity** parameter is set to a distinguished name, the default value of **Partition**
1098+
is automatically generated from this distinguished name.
1099+
- If running cmdlets from an Active Directory provider drive, the default value of **Partition** is
10921100
automatically generated from the current path in the drive.
1093-
- If none of the previous cases apply, the default value of_Partition_ is set to the default
1101+
- If none of the previous cases apply, the default value of **Partition** is set to the default
10941102
partition or naming context of the target domain.
10951103

1096-
In AD LDS environments, a default value for _Partition_ will be set in the following cases:
1104+
In AD LDS environments, a default value for **Partition** will be set in the following cases:
10971105

1098-
- If the _Identity_ parameter is set to a distinguished name, the default value of _Partition_ is
1099-
automatically generated from this distinguished name.
1100-
- If running cmdlets from an Active Directory provider drive, the default value of _Partition_ is
1106+
- If the **Identity** parameter is set to a distinguished name, the default value of **Partition**
1107+
is automatically generated from this distinguished name.
1108+
- If running cmdlets from an Active Directory provider drive, the default value of **Partition** is
11011109
automatically generated from the current path in the drive.
1102-
- If the target AD LDS instance has a default naming context, the default value of _Partition_ is
1110+
- If the target AD LDS instance has a default naming context, the default value of **Partition** is
11031111
set to the default naming context. To specify a default naming context for an AD LDS environment,
11041112
set the **msDS-defaultNamingContext** property of the Active Directory directory service agent
11051113
object (**nTDSDSA**) for the AD LDS instance.
1106-
- If none of the previous cases apply, the _Partition_ parameter does not take any default value.
1114+
- If none of the previous cases apply, the **Partition** parameter does not take any default value.
11071115

11081116
```yaml
11091117
Type: String
@@ -1141,11 +1149,12 @@ Specifies whether the password of an account can expire. This parameter sets the
11411149
**ADS_UF_DONT_EXPIRE_PASSWD** flag of the Active Directory User Account Control attribute. The
11421150
acceptable values for this parameter are:
11431151

1144-
- $False or 0
1145-
- $True or 1
1152+
- `$False` or `0`
1153+
- `$True` or `1`
11461154

1147-
Note: This parameter cannot be set to $True or 1 for an account that also has the
1148-
**ChangePasswordAtLogon** property set to $True.
1155+
> [!NOTE]
1156+
> This parameter cannot be set to `$True` or `1` for an account that also has the
1157+
> **ChangePasswordAtLogon** property set to `$True`.
11491158

11501159
```yaml
11511160
Type: Boolean
@@ -1166,8 +1175,8 @@ property of an account, such as a user or computer account. This parameter also
11661175
**ADS_UF_PASSWD_NOTREQD** flag of the Active Directory User Account Control attribute. The
11671176
acceptable values for this parameter are:
11681177

1169-
- $False or 0
1170-
- $True or 1
1178+
- `$False` or `0`
1179+
- `$True` or `1`
11711180

11721181
```yaml
11731182
Type: Boolean
@@ -1201,9 +1210,8 @@ Accept wildcard characters: False
12011210

12021211
### -PostalCode
12031212

1204-
Specifies the postal code or zip code.
1205-
This parameter sets the **PostalCode** property of a user object.
1206-
The LDAP display name (**ldapDisplayName**) of this property is postalCode.
1213+
Specifies the postal code or zip code. This parameter sets the **PostalCode** property of a user
1214+
object. The LDAP display name (**ldapDisplayName**) of this property is `postalCode`.
12071215

12081216
```yaml
12091217
Type: String
@@ -1264,8 +1272,8 @@ format for this parameter is:
12641272

12651273
`-Remove @{Attribute1LDAPDisplayName=value1, value2, ...; Attribute2LDAPDisplayName=value1, value2, ...; AttributeNLDAPDisplayName=value1, value2, ...}`
12661274

1267-
When you use the _Add_, _Remove_, _Replace_, and _Clear_ parameters together, the parameters are
1268-
applied in the following sequence:
1275+
When you use the **Add**, **Remove**, **Replace**, and **Clear** parameters together, the
1276+
parameters are applied in the following sequence:
12691277

12701278
- **Remove**
12711279
- **Add**
@@ -1295,8 +1303,8 @@ an error. The format for this parameter is:
12951303

12961304
`-Replace @{Attribute1LDAPDisplayName=value1, value2, ...; Attribute2LDAPDisplayName=value1, value2, ...; AttributeNLDAPDisplayName=value1, value2, ...}`
12971305

1298-
When you use the _Add_, _Remove_, _Replace_, and _Clear_ parameters together, the operations will be
1299-
performed in the following order:
1306+
When you use the **Add**, **Remove**, **Replace**, and **Clear** parameters together, the
1307+
operations will be performed in the following order:
13001308

13011309
- **Remove**
13021310
- **Add**
@@ -1321,10 +1329,11 @@ Specifies the Security Account Manager (SAM) account name of the user, group, co
13211329
account. The maximum length of the description is 256 characters. To be compatible with older
13221330
operating systems, create a SAM account name that is 20 characters or less. This parameter sets the
13231331
**SAMAccountName** for an account object. The LDAP display name (**ldapDisplayName**) for this
1324-
property is sAMAccountName.
1332+
property is `sAMAccountName`.
13251333

1326-
Note: If the string value provided is not terminated with a $ character, the system adds one if
1327-
needed.
1334+
> [!NOTE]
1335+
> If the string value provided is not terminated with a `$` character, the system adds one if
1336+
> needed.
13281337

13291338
```yaml
13301339
Type: String
@@ -1378,7 +1387,7 @@ Directory server values:
13781387
The default value for this parameter is determined by one of the following methods in the order that
13791388
they are listed:
13801389

1381-
- By using the _Server_ value from objects passed through the pipeline
1390+
- By using the **Server** value from objects passed through the pipeline
13821391
- By using the server information associated with the AD DS Windows PowerShell provider drive, when
13831392
the cmdlet runs in that drive
13841393
- By using the domain of the computer running Windows PowerShell
@@ -1397,10 +1406,10 @@ Accept wildcard characters: False
13971406

13981407
### -ServicePrincipalNames
13991408

1400-
Specifies the service principal names for the account. This parameter sets the ServicePrincipalNames
1401-
property of the account. The LDAP display name (ldapDisplayName) for this property is
1402-
servicePrincipalName. This parameter uses the following syntax to add, remove, replace or clear
1403-
service principal name values.
1409+
Specifies the service principal names for the account. This parameter sets the
1410+
**ServicePrincipalNames** property of the account. The LDAP display name (**ldapDisplayName**) for
1411+
this property is `servicePrincipalName`. This parameter uses the following syntax to add, remove,
1412+
replace or clear service principal name values.
14041413

14051414
Syntax:
14061415

@@ -1549,8 +1558,8 @@ service. This parameter sets the **TrustedForDelegation** property of an account
15491558
also sets the **ADS_UF_TRUSTED_FOR_DELEGATION** flag of the Active Directory User Account Control
15501559
attribute. The acceptable values for this parameter are:
15511560

1552-
- $False or 0
1553-
- $True or 1
1561+
- `$False` or `0`
1562+
- `$True` or `1`
15541563

15551564
```yaml
15561565
Type: Boolean
@@ -1612,10 +1621,10 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
16121621

16131622
### None or Microsoft.ActiveDirectory.Management.ADUser
16141623

1615-
A user object is received by the _Identity_ parameter.
1624+
A user object is received by the **Identity** parameter.
16161625

1617-
A user object that was retrieved by using the **Get-ADUser** cmdlet and then modified is received by
1618-
the _Instance_ parameter.
1626+
A user object that was retrieved by using the `Get-ADUser` cmdlet and then modified is received by
1627+
the **Instance** parameter.
16191628

16201629
## OUTPUTS
16211630

0 commit comments

Comments
 (0)