New-ADComputer
Use New-ADComputer to create a computer account in Active Directory before the machine joins the domain.
Documentation: Microsoft Learn — New-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.
New-ADComputer [-Name] <String> [-Path <String>] [-SamAccountName <String>] [-Enabled <Boolean>] [-Description <String>] [-Location <String>] [-WhatIf] [<CommonParameters>]- Stage 1New-ADComputer
-Name -Path -SamAccountName -Enabled -Description -Location -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
New-ADComputer -Name SRV02
Show reference output
Sample output · fictional data, shaped like the real thing
Name SamAccountName DNSHostName Enabled ---- -------------- ----------- ------- SRV02 SRV02$ SRV02.corp.local True
Get-ADComputer -Identity SRV02
Show reference output
Sample output · fictional data, shaped like the real thing
Name DistinguishedName ----- ------------------------------------ SRV01 CN=SRV01,OU=Servers,DC=corp,DC=local SRV02 CN=SRV02,OU=Servers,DC=corp,DC=local
Get-ADComputer -Filter *
Show reference output
Sample output · fictional data, shaped like the real thing
Name ----- SRV01 SRV02
Parameters
Parameter definitions:
-Name-Path-SamAccountName-Enabled-Description-Location-WhatIf
Practical use and troubleshooting
Practical scenario: Use New-ADComputer when you need to create a computer account in Active Directory before the machine joins the domain. 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 duplicate-name error needs checking whether the computer account already exists. Confirm the intended OU and reuse policy before creating another directory object. 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: Set-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
New-ADComputer Use New-ADComputer to create a computer account in Active Directory before the machine joins the domain.
Next: Set-ADComputer