Using PowerShell remoting
In this recipe, we will use PowerShell remoting to execute commands on a remote machine.
Getting ready
To work with remoting in PowerShell, we first need to identify which remote machine we want to use. In this recipe, we will assume that there are two machines in the same domain that we can use.
Log in to the machine you want to use for remoting. We will refer to this as <Remote Machine Name>
. PowerShell remoting needs to be enabled on this machine.
Note
Check out the system and permission requirements for running PowerShell remoting from MSDN about_Remote_Requirements (http://msdn.microsoft.com/en-us/library/hh847859.aspx).
To turn on remoting, open the PowerShell console in <Remote Machine Name>
using elevated privileges. Right-click on the PowerShell console and go to Run as Administrator. Execute the following command:
PS> Enable-PSRemoting
You will be prompted to confirm the changes a couple of times. Answer A
(or Yes to All
) to these questions.
The...