Skip to content

Join/Add a Computer to the domain via PowerShell Command Line

Quick Post, as I always need this syntax

Server 2012:

Add-Computer -DomainName tomuc.int -Credential tomuc\administrator -Restart -Verbose

Or if you don’t want to be prompted for credentials:

$domain = “ccddbank.com”
$UserName = “ccddbank\administrator”
$Password = “Password123” | ConvertTo-SecureString -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName,$Password
Add-Computer -DomainName $domain -DomainCredential $Credential -Restart -Verbose

image

Server 2008 R2 (has no –restart parameter)

Add-Computer -DomainName tomuc.int -Credential tomuc\administrator -Verbose

Restart-Computer

 

image

Published inLync

Be First to Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.