fbpx

How To Add a Computer To A Domain Using PowerShell? 3 Best Methods Explained

Let’s say you want to configure multiple computers in a script or when there is no GUI (Server Core) and you want to add a machine to a domain using the command line. The Add-Computer cmdlet transfers computers from one domain to another or Add a Computer to a workgroup or domain.

You will discover how to add the computer to a domain using the Windows GUI, command line, and PowerShell in this lesson.

How to add a computer to a Domain with PowerShell?

You can use PowerShell to add a computer to a domain if you have several computers to add to the domain, have an automated onboarding process, or prefer the command-line.

  • Make sure Windows PowerShell is running as administrator before starting it.
PowerShell is running as administrator
  • Run the Add-Computer cmdlet in the PowerShell console.
  • The same task as adding a computer to a domain using the GUI is carried out by this cmdlet.
  • Use the DomainName argument to specify the domain name to which the computer should be added.
  • Restart is an optional parameter that you can use to automatically restart the computer after completion.
  • To add a computer to a domain using PowerShell, you can use the Add-Computer cmdlet with the -DomainName parameter. Here’s an example command:
Add-Computer -DomainName "example" -Credential "example\administrator" -Restart
Add-Computer -DomainName "example" -Credential "example\administrator" -Restart

How to Add a local Computer account to a Domain via the GUI

  • Run the sysdm.cpl command. With this command, the System Properties control panel applet will be displayed.
Run the sysdm.cpl command.
  • Click the Change button on the System Properties screen. The Computer Name/Domain Changes dialog box will appear when you press this button.
click on the change optionj
  • This computer is a member of the WORKGROUP workgroup, as you can see below. 
computer is a member of the WORKGROUP workgroup
  • To add a computer to a domain, select the Domain radio option in the Computer Name/Domain Changes dialog box.
  • Type the domain’s name into the Domain box, then click OK to add the machine to that domain. The machine will then make an effort to get in touch with a domain controller and join the domain.
  • If your computer cannot quickly connect to the domain name you specified, it displays the following error: Make that the computer’s DNS server points to a domain controller if it is unable to connect to a domain controller.
  • To locate a domain controller, the computer must be able to locate the DNS SRV record. You will be prompted for a username and password if the machine is able to connect to a domain controller. Click OK after entering a user account that has the necessary rights to add this computer to the domain.
  • A mail introducing you to the domain will be sent to you. The computer creates an AD computer object. Select OK. To confirm that the computer has to restart, click OK once more.
  • You’ll notice a warning. “After you restart this computer, changes will take effect.” Select Close.
  • When you select Close, Windows will ask you to restart right away. To restart the computer right now, click Restart now.

Add Local Computer to a Domain via the Settings app

You can use the following steps to Add a Computer using the settings menu in Windows 10.

  • On the start menu, select Settings from the context menu.
  • Select Accounts from Settings. On the following page, select “Access Work or School” and then, to the right, select “Connect.”
Access Work or School
  • In the Microsoft account dialog box, select “Join this device to local Active Directory Domain” and then click Next if you want to add this computer to the local Active Directory domain.
image 4
  • Enter your domain name and then click Next on the following screen.
Enter your domain name
  • You will be prompted for a username and password if the machine is able to connect to a domain controller. Click OK after entering a user account with the necessary rights to add this computer to the domain.
  • Choose the type of account that will utilize this device.
  • If you choose administrator, the local administrator’s group on the system will be added to the user you used to add this machine to the domain.
  • If you choose the standard user, the user will not be added to the local administrator’s group. 
  • To restart the computer right now, click Restart now.
  • After restarting the computer, you can log in using your domain user ID.
  • Now, Check if you are able to add a computer or not.