CATEGORIES

Ads

Blog Archive

Saturday, May 26, 2018

ADDING WINDOWS 10 TO A DOMAIN USING POWERSHELL

This works fine but sometimes you need to automate this process or simply like the command line. There's another way and it's through PowerShell. By using PowerShell, you can greatly speed up the process of clicking through Windows and specify all the necessary criteria in one shot.

To add a Windows 10 computer to a domain with PowerShell requires using the Add-Computer cmdlet. This is a cmdlet that allows you to pass in all of the required attributes necessary that you provided in the windows above as parameters.

To do this, you'll first need to bring up the PowerShell console in Windows 10. You can do this by typing in "powershell" in the Search box, right clicking on Windows PowerShell and running as administrator.

Once you have the blue window of PowerShell up, you can now begin sending commands. We'll use the Add-Computer cmdlet.

To use Add-Computer to add the local computer to the domain requires, at a minimum, two parameters: DomainName and Credential. Each parameter is specified with a dash, the parameter name and the value.

Add-Computer –DomainName mylab.local –Credential (Get-Credential)

From the code sample above, you can see that we're again adding the Windows 10 computer to the mylab.local domain. We're also using the Credential parameter since we
 still need to specify an account with permission to add a computer to the domain. This requires a PSCredential object. To build this object you can use the Get-Credential command surrounded by parentheses. This tells PowerShell to run this command before 
running Add-Computer. Not that this will prompt you for a username and password.

Once this command runs, restart your computer and the task is complete!

Adding a Windows 10 to a domain is very straightforward. As you saw, depending on the context, there are a couple of different ways to make it happen. Be sure to choose the method that's easiest and most convenient for you.


No comments:

Post a Comment