PowerShell Logo Small

Add-Computer



This is the built-in help made by Microsoft for the command 'Add-Computer', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Add the local computer to a domain or workgroup.

SYNTAX


Add-Computer [-DomainName] <string> [-Credential <PSCredential>] [-OUPath <string>] [-Server <string>] [-Unsecure] [-PassThru] [-Confirm] [-WhatI
f] [<CommonParameters>]
Add-Computer [-WorkGroupName] <string> [-Credential <PSCredential>] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Add-Computer cmdlet adds the local computer to a domain or workgroup, or moves it from one domain to another. It also creates a domain accoun
t if the computer is added to the domain without an account.

You can use the parameters of this cmdlet to specify an organizational unit (OU) and domain controller or to perform an unsecure join.

To get the results of the command, use the Verbose and PassThru parameters.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=135194
Checkpoint-Computer
Remove-Computer
Restart-Computer
Restore-Computer
Stop-Computer
Test-Connection

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>add-computer -domainname Domain01; restart-computer



Description
-----------
These commands add the local computer to the Domain01 domain using the credentials of the current user.

The first command adds the computer to the domain. The second command uses the Restart-Computer cmdlet to restart the computer, which completes t
he join operation. The semi-colon (;) separates the two commands.








-------------------------- EXAMPLE 2 --------------------------

C:\PS>add-computer -workgroupname WORKGROUP-A



Description
-----------
This command adds the local computer to the Workgroup-A workgroup.








-------------------------- EXAMPLE 3 --------------------------

C:\PS>add-computer -DomainName Domain01 -Server Domain01\DC01 -passthru -verbose



Description
-----------
This command adds the local computer to the Domain01 domain by using the Domain01\DC01 domain controller.

The command uses the PassThru and Verbose parameters to get detailed information about the results of the command.








-------------------------- EXAMPLE 4 --------------------------

C:\PS>Add-Computer -domainname Domain02 -OUPath OU=testOU,DC=domain,DC=Domain,DC=com



Description
-----------
This command adds the Server01 and Server02 computers to the Domain02 domain. It uses the OUPath command to specify the organization unit for the
new accounts.








-------------------------- EXAMPLE 5 --------------------------

C:\PS>Add-Computer -domainname Domain02 -cred Domain02\Admin02 -passthru



Description
-----------
This command adds the local computer to the Domain02 domain by using the credentials of a domain administrator. The command uses the PassThru par
ameter to generate a brief report about the results of the command.