Set-ADUser
Use Set-ADUser to modify attributes on an existing Active Directory user account.
Documentation: Microsoft Learn — Set-ADUser
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Set-ADUser [-Identity] <ADUser> [-Replace <Hashtable>] [-Add <Hashtable>] [-Remove <Hashtable>] [-Clear <String[]>] [-Enabled <Boolean>] [-Department <String>] [-Manager <ADUser>] [-WhatIf] [<CommonParameters>]- Stage 1Set-ADUser
-Identity -Replace -Add -Remove -Clear -Enabled -Department -Manager -WhatIf
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
Set-ADUser -Identity jsmith
Show reference output
Sample output · fictional data, shaped like the real thing
Department : Sales DistinguishedName : CN=John Smith,OU=Users,DC=corp,DC=local Name : John Smith SamAccountName : jsmith Title : Account Manager
Set-ADUser -Identity jsmith (2)
Show reference output
Sample output · fictional data, shaped like the real thing
DistinguishedName : CN=John Smith,OU=Users,DC=corp,DC=local Name : John Smith physicalDeliveryOfficeName : London SamAccountName : jsmith
Get-ADUser -Filter 'Department -eq "Sales"'
Show reference output
Sample output · fictional data, shaped like the real thing
Name ---------- Jane Smith Alex Jones
Parameters
Parameter definitions:
-Identity-Replace-Add-Remove-Clear-Enabled-Department-Manager-WhatIf
Practical use and troubleshooting
Practical scenario: Use Set-ADUser when you need to modify attributes on an existing Active Directory user account. Review syntax and sample output, then try an example in the browser lab. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: Identity not found can result from passing a display name instead of an accepted identifier. Resolve the account first and use its distinguished name, GUID or other supported identity. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: New-ADUser. New-ADUser creates a user object; Set-ADUser changes an existing one. Creation settings and subsequent account updates should be reviewed separately in a bulk provisioning workflow. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Set-ADUser Use Set-ADUser to modify attributes on an existing Active Directory user account.
Next: New-ADUser