How To Join Computer To The AD Domain Using PowerShell?
Maybe your like
- Home
- Whiteboard
- Online Compilers
- Practice
- Articles
- AI Assistant
- Jobs
- Tools
- Corporate Training
- Courses
- Certifications
- Switch theme
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
To join any workgroup computer in the domain using PowerShell, we can use the Add-Computer command but before that, there are a few Windows prerequisite that DNS must be configured properly and the domain controller should be reachable and others should suffice then only PowerShell can use the command to join computer into a domain.
Add-Computer -ComputerName Test1-win2k16 ` -DomainCredential Labdomain\Administrator ` -DomainName Labdomain.local -Restart -Force -PassThruOnce you run the above command, it will ask you for the credential for the user you entered. In the above example, we are joining a remote computer to the domain LabDomain.Local and it will restart the remote system. If the users are logged in on the remote system, it might not restart but the system will connect to the domain. You can restart later forcefully.
We need to make sure that the username used in the -DomainCredential parameter, should have proper privileges like DomainAdmin, EnterpriseAdmin.
To Join the computer in the Different OU, you need to provide the OU path
Add-Computer -ComputerName Test1-win2k16 ` -DomainCredential Labdomain\Administrator ` -DomainName Labdomain.local ` -OuPath 'OU=Prod,OU=Servers,DC=labdomain,DC=local' ` -Restart -Force -PassThruHere the computer Name parameter is String[] so you can use multiple computers. For example,
Add-Computer -ComputerName Test1-win2k16, Test1-Win2k12, Test2-Win2k12 ` -DomainCredential Labdomain\Administrator ` -DomainName Labdomain.local ` -OuPath 'OU=Prod,OU=Servers,DC=labdomain,DC=local' ` -Restart -Force -PassThruYou can also use the foreach loop and the list of computers from the CSV file to join multiple computers if the OU path is different.
Chirag Nagrekar Updated on: 2020-12-28T07:00:56+05:30 2K+ Views
Kickstart Your Career
Get certified by completing the course
Get StartedTag » Active Directory Add Computer To Domain Powershell
-
How To Add Computers To A Domain Using PowerShell
-
Add-Computer (Microsoft.PowerShell.Management)
-
Join Computer To Domain Using PowerShell - Active Directory Pro
-
How To Add A Computer To A Domain (GUI And PowerShell)
-
How To Manage Computers In Active Directory Using PowerShell
-
Script To Add Windows Devices To Active Directory Domain - Hexnode
-
How To Add Computer To A Domain Using PowerShell
-
Add A Computer To An Active Directory Domain With PowerShell
-
Active Directory: How To Join A Computer To The Domain Using GUI Or ...
-
Adding Active Directory Users, Groups And Computers With PowerShell
-
Join Computer To Domain Using Windows Powershell! - YouTube
-
Active Directory Queries With PowerShell - ScriptRunner
-
Create Computer Objects In Active Directory Using PowerShell
-
Active Directory PowerShell Script To Add Computers To AD Group