Join/Add A Computer To The Domain Via PowerShell Command Line

Skip to content Sidebar Join/Add a Computer to the domain via PowerShell Command Line Published by Tom Arbuthnot on August 18, 2013

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
  • PowerShell
Previous Post PowerShell Add a Persistent Module Path to $env:PSModulePath Next Post I’ll be speaking at #PowerShell PowerCamp 19/20th October at Microsoft London Offices

Be First to Comment

Leave a ReplyCancel reply

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

Manage Cookie Consent I use cookies to optimize my blog. Functional Functional Always active The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network. Preferences Preferences The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user. Statistics Statistics The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you. Marketing Marketing The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
Accept Deny Preferences Save preferences Preferences
  • {title}
  • {title}
  • {title}
Manage consent

Tag » Add-computer To Domain Powershell With Password