Would you like to learn how to execute remote commands using Powershell? In this tutorial, we are going to show you how to use the WinRM feature to execute remote commands using Powershell on a computer running Windows.
• Windows 2012 R2
• Windows 2016
• Windows 2019
• Windows 10
• Windows 7
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Related tutorial – PowerShell
On this page, we offer quick access to a list of tutorials related to PowerShell.
Tutorial Powershell – Enable the WinRM service
Access the server where you want to execute remote commands.
As an Administrator, start a Powershell command-line.
Enable the WinRM service.
Verify the network configuration of the WinRM service.
Here is the command output.
In our example, the WinRM service is listening on the TCP port 5985.
In our example, the WinRM service is allowing HTTP connections.
Verify the WinRM service configuration
Here is the command output.
Test the local connection to the WinRM service.
Here is the command output.
Congratulations! You are able to enable the WinRM service to allow remote commands using Powershell.
Tutorial WinRM – Remote commands using Powershell.
On the client computer, start a Powershell command-line.
Test the connection to the remote computer on the TCP port 5985.
Here is the command output.
Test the connection to the remote WinRM service.
Here is the command output.
Execute a remote command using WinRM and Powershell.
Enter the credentials to access the remote computer.
Here is the command output.
In our example, a single command was executed remotely using WinRM and Powershell.
Execute a remote command using a stored credential.
There are multiple ways to use Powershell, WinRM, and a stored credential.
Congratulations! You are able to use WinRM to send remote commands using Powershell.
Tutorial WinRM – Remote session using Powershell.
On the client computer, start a Powershell command-line.
Test the connection to the remote computer on the TCP port 5985.
Here is the command output.
Test the connection to the remote WinRM service.
Here is the command output.
Start a remote session using Powershell and WinRM.
Enter the credentials to access the remote computer.
Here is the command output.
In our example, a remote session was started using WinRM and Powershell.
Start a remote session using a stored credential.
There are multiple ways to use Powershell, WinRM, and a stored credential.
Congratulations! You are able to use WinRM to start a remote session using Powershell.