Add the local computer to a domain or workgroup. Move a computer account from one domain to another. Add-Computer will create new domain computer accounts as required.
Syntax
Add-Computer [-DomainName] string
[-Credential PSCredential] [-OUPath string] [-Server string]
[-Unsecure] [-PassThru]
[-Confirm] [-WhatIf] [CommonParameters]
Add-Computer [-WorkGroupName] string
[-Credential PSCredential]
[-PassThru] [-Confirm] [-WhatIf] [CommonParameters]
key
-DomainName string
A domain for the computer account. This parameter is required.
-Credential
a user account that has permission to perform this action.
The default is the current user.
-OUPath string
An organizational unit (OU) distinguished name for the domain account.
Default value = the default OU for machine objects.
-PassThru
Pass the object created by this cmdlet through the pipeline.
-Server DomainName\ComputerName
The domain controller that will add the computer to the domain.
Default = the local computer.
-Unsecure
Perform an unsecure join
-WorkGroupName string
The name of a work group for the computer.
If you omit this parameter, the computer is joined to a domain.
-whatIf
Describe the command without actually executing it.
-confirm
Prompt for confirmation before executing the command.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.
Examples
1) Add the local computer to the SS64 domain using the credentials of the current user:
PS C:\> add-computer -domainname SS64Dom; restart-computer
2) Add the local computer to the SS64 domain by using the SS64Dom\DC01 domain controller:
PS C:\> add-computer -DomainName SS64Dom -Server SS64Dom\DC01 -passthru -verbose
3) Add the local computer to the SS64 domain and place in a specific OU:
PS C:\> Add-Computer -domainname SS64Dom -OUPath OU=Sales,DC=SS64,DC=com -cred SS64Dom\Administrator -passthru
“Since time is the one immaterial object which we cannot influence--neither speed up nor slow down, add to nor diminish--it is an imponderably valuable gift” - Maya Angelou
Related:
Checkpoint-Computer - Create a system restore point on the local computer.
© Copyright SS64.com 1999-2013
Some rights reserved