Run Powershell Commands on remote computer
- By : Dom
- Category : Scripting
- Tags: Powershell
With Powershell remoting , you can run Powershell commands or access full Powershell sessions on remote windows system. By default this is not enabled so we have to enable Powershell remoting on a machine before it can be used.
Will show you how to enable it on a domain PC and a workgroup machine.
Enabling Powershell Remoting on a Domain PC you want to Access remotely
First of all, you’ll need to run Powershell as an Administrator.
In the PowerShell window, type the following cmdlet , and then hit Enter:
1 |
Enable-PSRemoting -Force |
his command starts the WinRM service, sets it to start automatically with your system, and creates a firewall rule that allows incoming connections. The -Force
part of the cmdlet tells PowerShell to perform these actions without prompting you for each step.
If your PCs are part of a domain, that’s all the setup you have to do. You can skip on ahead to testing your connection. If your computers are part of a workgroup—which they probably are on a home or small business network—you have a bit more setup work to do.
Note: Your success in setting up remoting in a domain environment depends entirely on your network’s setup. Remoting might be disabled—or even enabled—automatically by group policy configured by an admin. You might also not have the permissions you need to run PowerShell as an administrator. As always, check with your admins before you try anything like this. They might have good reasons for not allowing the practice, or they might be willing to set it up for you.
Enabling Powershell Remoting on a Workgroup PC you want to Access remotely
If your computers aren’t on a domain, you need to perform a few more steps to get things set up. You should have already enabled Remoting on the PC to which you want to connect, as we described in the previous section.
No Comments