Set-ADComputer
Use Set-ADComputer to modify attributes on an existing Active Directory computer account.
Documentation: Microsoft Learn — Set-ADComputer
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-ADComputer [-Identity] <ADComputer> [-Description <String>] [-Location <String>] [-ManagedBy <ADPrincipal>] [-Enabled <Boolean>] [-Replace <Hashtable>] [-Add <Hashtable>] [-Clear <String[]>] [-TrustedForDelegation <Boolean>] [-WhatIf] [<CommonParameters>]- Stage 1Set-ADComputer
-Identity -Description -Location -ManagedBy -Enabled -Replace -Add -Clear -TrustedForDelegation -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-ADComputer -Identity SRV01
Show reference output
Sample output · fictional data, shaped like the real thing
Description : App server, owned by platform team DistinguishedName : CN=SRV01,OU=Servers,DC=corp,DC=local DNSHostName : SRV01.corp.local Enabled : True Name : SRV01 ObjectClass : computer
Set-ADComputer -Identity SRV01 (2)
Show reference output
Sample output · fictional data, shaped like the real thing
DistinguishedName : CN=SRV01,OU=Servers,DC=corp,DC=local
Name : SRV01
ServicePrincipalNames : {HOST/SRV01, HOST/SRV01.corp.local, HTTP/app.corp.local}Get-ADComputer -Properties servicePrincipalName
Show reference output
Sample output · fictional data, shaped like the real thing
HOST/SRV01 RestrictedKrbHost/SRV01 HOST/SRV01.corp.local
Parameters
Parameter definitions:
-Identity-Description-Location-ManagedBy-Enabled-Replace-Add-Clear-TrustedForDelegation-WhatIf
Practical use and troubleshooting
Practical scenario: Use Set-ADComputer when you need to modify attributes on an existing Active Directory computer account. 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: A missing identity can mean the computer account is in another domain or has a different name. Resolve it in the intended directory before modifying attributes. 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-ADComputer. New-ADComputer creates a computer account; Set-ADComputer updates attributes of an existing one. Creating the account alone does not join a Windows computer to the domain. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Set-ADComputer Use Set-ADComputer to modify attributes on an existing Active Directory computer account.
Next: Set-ADUser