@@ -48,9 +48,10 @@ Set-ADUser [-WhatIf] [-Confirm] [-AuthType <ADAuthType>] [-Credential <PSCredent
48
48
49
49
## DESCRIPTION
50
50
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.
54
55
55
56
The * Identity* parameter specifies the Active Directory user to modify.
56
57
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
76
77
### Example 1: Set properties for a user
77
78
78
79
``` 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
80
86
```
81
87
82
88
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:
444
450
445
451
` -Clear Attribute1LDAPDisplayName, Attribute2LDAPDisplayName`
446
452
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 :
449
455
450
456
- **Remove**
451
457
- **Add**
@@ -491,10 +497,11 @@ for the user's device. This value sets the compound identity supported flag of t
491
497
- $False or 0
492
498
- $True or 1
493
499
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.
498
505
499
506
` ` ` yaml
500
507
Type: Boolean
@@ -553,8 +560,8 @@ with the drive is the default.
553
560
To specify this parameter, you can type a user name, such as `User1` or `Domain01\User01` or you can specify a **PSCredential** object.
554
561
If you specify a user name for this parameter, the cmdlet prompts for a password.
555
562
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.
558
565
559
566
If the acting credentials do not have directory-level permission to perform the task, Active
560
567
Directory PowerShell returns a terminating error.
@@ -836,9 +843,9 @@ The identifier in parentheses is the LDAP display name for the attribute.
836
843
The acceptable values for this parameter are :
837
844
838
845
- 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** )
842
849
843
850
The cmdlet searches the default naming context or partition to find the object.
844
851
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
884
891
specified, any modifications made to the **ADUser** object are also made to the corresponding Active
885
892
Directory object. The cmdlet only updates the object properties that have changed.
886
893
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.
890
897
891
898
` ` ` yaml
892
899
Type: ADUser
@@ -906,22 +913,23 @@ Specifies whether an account supports Kerberos encryption types which are used d
906
913
service tickets. This value sets the encryption types supported flags of the Active Directory
907
914
**msDS-SupportedEncryptionTypes** attribute. The acceptable values for this parameter are:
908
915
909
- - None
910
- - DES
911
- - RC4
912
- - AES128
913
- - AES256
916
+ - ` None`
917
+ - ` DES`
918
+ - ` RC4`
919
+ - ` AES128`
920
+ - ` AES256`
914
921
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
916
923
service tickets for services using the account.
917
924
918
925
DES is a weak encryption type that is not supported by default since Windows 7 and Windows Server
919
926
2008 R2.
920
927
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.
925
933
926
934
` ` ` yaml
927
935
Type: ADKerberosEncryptionType
@@ -938,10 +946,10 @@ Accept wildcard characters: False
938
946
939
947
# ## -LogonWorkstations
940
948
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.
945
953
946
954
The LDAP display name (**ldapDisplayName**) for this property is userWorkStations.
947
955
@@ -966,9 +974,9 @@ Note: The identifier in parentheses is the LDAP display name for the property.
966
974
The acceptable values for this parameter are :
967
975
968
976
- 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** )
972
980
973
981
The LDAP display name (**ldapDisplayName**) of this property is manager.
974
982
@@ -1078,32 +1086,32 @@ Accept wildcard characters: False
1078
1086
1079
1087
Specifies the distinguished name of an Active Directory partition.
1080
1088
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.
1082
1090
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.
1086
1094
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 :
1088
1096
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
1092
1100
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
1094
1102
partition or naming context of the target domain.
1095
1103
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 :
1097
1105
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
1101
1109
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
1103
1111
set to the default naming context. To specify a default naming context for an AD LDS environment,
1104
1112
set the **msDS-defaultNamingContext** property of the Active Directory directory service agent
1105
1113
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.
1107
1115
1108
1116
` ` ` yaml
1109
1117
Type: String
@@ -1141,11 +1149,12 @@ Specifies whether the password of an account can expire. This parameter sets the
1141
1149
**ADS_UF_DONT_EXPIRE_PASSWD** flag of the Active Directory User Account Control attribute. The
1142
1150
acceptable values for this parameter are :
1143
1151
1144
- - $False or 0
1145
- - $True or 1
1152
+ - ` $False` or `0`
1153
+ - ` $True` or `1`
1146
1154
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`.
1149
1158
1150
1159
` ` ` yaml
1151
1160
Type: Boolean
@@ -1166,8 +1175,8 @@ property of an account, such as a user or computer account. This parameter also
1166
1175
**ADS_UF_PASSWD_NOTREQD** flag of the Active Directory User Account Control attribute. The
1167
1176
acceptable values for this parameter are :
1168
1177
1169
- - $False or 0
1170
- - $True or 1
1178
+ - ` $False` or `0`
1179
+ - ` $True` or `1`
1171
1180
1172
1181
` ` ` yaml
1173
1182
Type: Boolean
@@ -1201,9 +1210,8 @@ Accept wildcard characters: False
1201
1210
1202
1211
# ## -PostalCode
1203
1212
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`.
1207
1215
1208
1216
` ` ` yaml
1209
1217
Type: String
@@ -1264,8 +1272,8 @@ format for this parameter is:
1264
1272
1265
1273
` -Remove @{Attribute1LDAPDisplayName=value1, value2, ...; Attribute2LDAPDisplayName=value1, value2, ...; AttributeNLDAPDisplayName=value1, value2, ...}`
1266
1274
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 :
1269
1277
1270
1278
- **Remove**
1271
1279
- **Add**
@@ -1295,8 +1303,8 @@ an error. The format for this parameter is:
1295
1303
1296
1304
` -Replace @{Attribute1LDAPDisplayName=value1, value2, ...; Attribute2LDAPDisplayName=value1, value2, ...; AttributeNLDAPDisplayName=value1, value2, ...}`
1297
1305
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 :
1300
1308
1301
1309
- **Remove**
1302
1310
- **Add**
@@ -1321,10 +1329,11 @@ Specifies the Security Account Manager (SAM) account name of the user, group, co
1321
1329
account. The maximum length of the description is 256 characters. To be compatible with older
1322
1330
operating systems, create a SAM account name that is 20 characters or less. This parameter sets the
1323
1331
**SAMAccountName** for an account object. The LDAP display name (**ldapDisplayName**) for this
1324
- property is sAMAccountName.
1332
+ property is ` sAMAccountName` .
1325
1333
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.
1328
1337
1329
1338
` ` ` yaml
1330
1339
Type: String
@@ -1378,7 +1387,7 @@ Directory server values:
1378
1387
The default value for this parameter is determined by one of the following methods in the order that
1379
1388
they are listed :
1380
1389
1381
- - By using the _Server_ value from objects passed through the pipeline
1390
+ - By using the **Server** value from objects passed through the pipeline
1382
1391
- By using the server information associated with the AD DS Windows PowerShell provider drive, when
1383
1392
the cmdlet runs in that drive
1384
1393
- By using the domain of the computer running Windows PowerShell
@@ -1397,10 +1406,10 @@ Accept wildcard characters: False
1397
1406
1398
1407
# ## -ServicePrincipalNames
1399
1408
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.
1404
1413
1405
1414
Syntax :
1406
1415
@@ -1549,8 +1558,8 @@ service. This parameter sets the **TrustedForDelegation** property of an account
1549
1558
also sets the **ADS_UF_TRUSTED_FOR_DELEGATION** flag of the Active Directory User Account Control
1550
1559
attribute. The acceptable values for this parameter are :
1551
1560
1552
- - $False or 0
1553
- - $True or 1
1561
+ - ` $False` or `0`
1562
+ - ` $True` or `1`
1554
1563
1555
1564
` ` ` yaml
1556
1565
Type: Boolean
@@ -1612,10 +1621,10 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
1612
1621
1613
1622
# ## None or Microsoft.ActiveDirectory.Management.ADUser
1614
1623
1615
- A user object is received by the _Identity_ parameter.
1624
+ A user object is received by the **Identity** parameter.
1616
1625
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.
1619
1628
1620
1629
# # OUTPUTS
1621
1630
0 commit comments