The following command is typed into powershell add-computer
Active Directory (AD) is a decades-old technology that thousands of organizations use every day. To take advantage of AD, you must join computers to an AD domain. You may not realize there are many different ways to do that, some better than others. Read on to learn how. Show
In this tutorial, you will learn how to add a computer to a domain using the Windows GUI and command-line with the netdom utility and PowerShell. Table of Contents PrerequisitesIf you’d like to follow along with all of the steps in this tutorial, ensure you have the following:
Adding a Computer to a Domain via the GUIOne of the most common ways to add a computer to an AD domain is the GUI. This approach is good when you need to just add a single or a few computers at once. This method is not good for adding multiple computers at one time. That’ll be later. Assuming you’re on a Windows 10 workgroup computer that can access an existing domain controller: 1. Run the command sysdm.cpl. This command will open the System Properties control panel applet. System Properties Dialog box2. On the System Properties screen, click the Change button. This button will bring up the Computer Name/Domain Changes dialog box. Change option in System Properties Dialog box3. You can see below this computer is in a workgroup called WORKGROUP. In the Computer Name/Domain Changes dialog box, click on the Domain radio option to input a domain to add this computer to. Computer Name/Domain Name Change Dialog box 4. Input the name of the domain to add the computer to in the Domain box and click OK. The computer will then attempt to contact a domain controller and add itself to the domain. Computer Name/Domain Name Change Dialog box Related:The Trust Relationship Between This Workstation and the Primary Domain Failed
5. If the computer can contact a domain controller, it will prompt you for a username and password, as shown below. Input a user account with permissions to add this computer to the domain and click OK. Domain Join Credentials Dialog box6. If all goes well, you will receive a message welcoming you to the domain as shown below. At this time, the computer creates an AD computer object. Click OK. Related:Get-ADComputer: Find Computers in OUs in PowerShell Successfully added to Domain Notification7. Click on OK again to confirm the need to restart the computer. Restart your computer Notification8. You’ll then be redirected back to the System Properties dialog box, but now you will see a warning (Changes will take effect after you restart this computer.) Click on Close. System Properties dialog box post joining to domain9. Once you click on Close, Windows will prompt you to restart now. Click on Restart now to restart the computer immediately. Local computer Restart promptAdding a Local Computer to a Domain via Settings app
1. Right click on start menu and click settings. Settings option in start menu2. Under settings, click on accounts Accounts option in Settings app3. In the next page, click on “Access Work or School” option and click on connect option to the right. Access work or school option in settings4. As we are going to join this machine to local Active Directory Domain, in the Microsoft account dialog box, click “Join this device to local Active Directory Domain” option and click Next. Join this device to local Active Directory Domain option5. In the next page, enter your domain name and click Next. Domain Name dialog box6. If the computer can contact a domain controller, it will prompt you for a username and password, as shown below. Input a user account with permissions to add this computer to the domain and click OK. Credentials dialog box7. In the next page, select the account type who will use this machine.
8. Click Restart now to restart the computer immediately. Restart prompt9. Once restarted you can login to the machine with a domain user id. Adding a Local Computer to a Domain via NetdomSo far, you have seen how to add a Windows 10 computer to the domain via GUI, but you don’t have to use the GUI. Instead, you can use the command-line using the netdom utility. Netdom is a command-line tool that comes with the RSAT package. Assuming you’re on a Windows 10 workgroup computer that can access an existing domain controller: 1. Open up cmd.exe as administrator. 2. Run
Netdom command output3. Now restart the computer and the computer will be joined to the domain. Adding a Local Computer to a Domain via PowerShellIf you have many computers to add to a domain, have an onboarding automation process, or prefer the command-line, you can use PowerShell to add a computer to a domain. Assuming you’re on a Windows 10 workgroup computer that can access an existing domain controller: 1. Open up Windows PowerShell ensuring you run it as administrator. Related:How to Run PowerShell as Administrator In the PowerShell console, run the 0 parameter to restart the computer when complete automatically.
Add-Computer cmdlet credentials promptAdd a Local Computer to a Domain Via WMITo ensure this tutorial covers all ways you can add a computer to a domain, let’s continue with a lesser-known method of using Windows Management Instrumentation (WMI). WMI is a ubiquitous part of Windows that contains loads of information about a PC and can perform actions on it. To add a local computer to a domain with WMI, you need to invoke a WMI method. This method performs the same task as using 4or the 5 PowerShell cmdlet.You can invoke WMI methods in many different ways. For this tutorial, let’s focus on two ways using the *wmic* command-line utility and PowerShell. Using WMICTo add a computer to a domain with WMIC: 1. Open a command prompt (cmd.exe) as administrator. 2. Run the below command. This command:
WMIC command output3. When completed, restart the computer. Using PowerShell’s wmic computersystem where name="%computername%" call joindomainorworkgroup fjoinoptions=3 name="homelab.local" username="homelab\labadmin" Password="secret"3 CmdletYou can also invoke the 4 WMI method using PowerShell. To do so:1. Open PowerShell as administrator. 2. Run the following command. This command performs the same task as wmic does above using the same arguments. Get-WMIObject command output3. When completed, restart the computer. Adding Computers Remotely to a DomainThroughout this tutorial, you’ve learned how to add a computer to a domain as you’re sitting in front of that actual computer. But what happens when you can’t sit in front of that computer, or you have many computers to add? In that case, PowerShell is your best friend. To add computers to a domain remotely, you could either choose to use the WMI method in PowerShell as describe above but use the 5 parameter on the 3 cmdlet or use PSRemoting.Related:PowerShell Remoting: The Ultimate Guide To join remote computers to domain remotely, invoke the 5 PowerShell cmdlet. But this time, use the 5 parameter.
1. On your local workstation (not the computer to add to a domain), open PowerShell as administrator. 2. Run the below command. This command:
Once invoked, the 5 cmdlet will then prompt you for passwords for the user01 and labadmin accounts. When complete, PowerShell will restart the remote computer automatically.
Confirming Creation of the AD Computer AccountWhen a computer is added to a domain, it creates a computer object. To ensure the computer created the computer object as expected, let’s open Active Directory Users and Computers (ADUC) to confirm. 1. RDP to your domain controller and open Active Directory Users and Computers (ADUC) or open ADUC on your local computer if you have the Remote Server Administration Tools (RSAT) package installed. Related:How to Install and Import the Active Directory Module 2. In ADUC, expand the domain name node (homelab.local in this case) and click on the Computers container. You should see the computer object added in the previous section. Active Directory Users and Computers snapin 3. Back on the Windows 10 computer, now log on with any AD user account by clicking on Other User on the login screen. Login as Other user option post domain joinedYou can now see your domain name under the Password box as shown below. Domain name while logging in
ConclusionThroughout this article, you’ve seen multiple ways to add computers to an AD domain. Each method has advantages and disadvantages, but you should now have all of the options in front of you. Now that you know all of the ways to add a computer to a domain, how will you add your next computer to a domain? Hate ads? Want to support the writer? Get many of our tutorials packaged as an ATA Guidebook. Explore ATA GuidebooksMore from ATA Learning & Partners
|