Add Computers to a Domain with PowerShell
Add Computers to a Domain with PowerShell
SHARE ARTICLE
by Russell Smith
Sometimes it can useful to add a computer to a domain Table of Last Update: Sep 04, 2024
using the command line, such as when no GUI is available (as May 15, 2014
contents
is the case with Server Core), or just to expedite the process
Table of Russell Smith, the Editorial Director at Petri IT
when configuring multiple computers. In this easy Ask the
contents
Admin, I’ll show you how to add one or more Windows 8.1 Knowledgebase, has over two decades of hands-on
and Windows Server 2012 R2 PCs to a domain using experience in IT, in both small business settings and
Performing a
PowerShell. government IT infrastructure projects. Russell started
Domain Joi…
writing for Windows IT Pro Magazine in t...
The instructions in this article assume that DNS resolution is
Join Multiple
working correctly, i.e. you can resolve the domain name of
PCs to a…
the Active Directory domain you want to join, and that you
have connectivity to a domain controller (DC). RELATED ARTICLES
Advertisement
Mastering the PowerShell Trim Method
Nov 13, 2024 Nov 18, 2024
Performing a Domain Join
Using PowerShell How to Add Comments to Your PowerShell Code
and Scripts
Once you’ve established correct DNS resolution for the
domain name, start a PowerShell prompt with local Jul 15, 2024 Nov 19, 2024
administrative privileges.
Microsoft Copilot
Google Gemini
Add a computer to a domain using PowerShell.
IBM Watson
Other
You can add more than one computer to the domain, either
by using names from a text file or listing them in the
https://petri.com/add-computer-to-domain-powershell/ 1/2
1/8/25, 2:43 PM Add Computers to a Domain with PowerShell
command line as a comma-delimited list. You can use the – Submit View results
computername parameter even if PowerShell Remoting isn’t
enabled on the computers listed in the command line.
Advertisement
add-computer -computername (get-content servers.txt)
-domainname ad.contoso.com –credential ADadminuser
-restart –force
SHARE ARTICLE
https://petri.com/add-computer-to-domain-powershell/ 2/2