Remote Management Tools in Windows

Before you start

Objectives: Learn how to enable Windows Remote Management service and which tools can be used for remote management.

Prerequisites: no prerequisites.

Key terms: remote management, WinRM service, WinRS, PowerShell


Remote Management Service

As computer administrators, we will often want to execute commands on remote computers. These commands can be simple commandline tools or scripts. The Windows Remote Management service (WinRM) allows us to execute commands on a remote computer. We can do this either from the command prompt using Windows Remote Shell (Win RS), or using Windows PowerShell.

Before we can use Win RS or PowerShell for remote management tasks, we need to configure the target computer by running the following command in elevated prompt:

winrm qc

This will start the Windows RM service, and also set some administrative rights and necessary WinRM firewall exceptions.

We also need to authenticate the local computer and the remote computer. In a domain, Active Directory provides authentication. if we are not in a domain, we can use the following command to set trust between our computers.

winrm set winrm/config/client @{TrustedHosts="computername"}

Windows Remote Management options can be configured trough group policy setting. These settings are stored under the Computer Configuration > Policies > Administrative Templates > Windows Components > Windows Remote Management. Settings are are split between Windows RM client and Windows RM servicing policies.

When we have set this, we can use a tool like Win RS or PowerShell to send commands to the remote computer.

Windows Remote Shell

To use Windows RS, we open a command prompt and prefix the command that we want to run on the remote computer with the following:

winrs -r:hostname command

Note that we need to specify the computer name and then the command. We can use the NetBIOS name of the computer if it’s on a local network, or the IP or fully qualified domain name if it’s on another network or Internet. We can also specify authentication credentials to be used on a remote computer: With the “-u” parameter we specify the username, and with the “-p” parameter we specify a password. If we do not use the “-p” parameter, we will be prompted to enter a password after you execute the command. WinRS sets up HTTP listeners on ports 80 or 443, which are allowed by most firewalls.

We can also configure some Windows RS options through group policies. The policy exists in the Computer Configuration > Policies > Administrative Templates > Windows Components > Windows Remote Shell. We can configure settings such as idle timeout, maximal concurrent remote shells, and whether remote shell access is allowed.

PsExec

Another useful tool for remote management is the PsExec application. We can download PsExec for free from Microsoft.com as part of the PsTools suite of SysInternals. It’s a remote control program or remote management application similar to WinRS. It lets us execute programs on remote systems. It also enables us to run console applications remotelly, making the application appear to be running locally. It doesn’t require client-side software.

PowerShell

Windows PowerShell is a task-based commandline shell and scripting language designed for system administrators. It is built on the .NET framework. It is used for control and automation of Windows administration tasks. With PowerShell we can manage computers from the command line.

PowerShell uses special commands known as cmdlets, which can execute single commands or large scripts. PowerShell commands have a specific naming format that includes a verb and a noun separate by a dash. Slashes are not used with parameters in Windows PowerShell. We can combine two or more cmdlets, and this process is known as piping. This way we can pipe the result from one command to be input for another command. Each cmdlet has a help file. We can get help by typing “get help” and then the name of the cmdlet. Windows PowerShell supports remote management of computers, starting from PowerShell version 2. We can use Windows PowerShell to manage a computer remotely if we have configured the Windows Remote Management service.

To run PowerShell commands remotely, we can use the “icm” command, with the name of the remote computer and then the power shell command in brackets, like this:

icm hostname {PS command}

Computer Management Console

Computer Management is a saved MMC console that includes common snap-ins used to manage a local or remote computer. To manage a remote computer with Computer Management, we can select “Connect to another computer…” option from the Action menu in the Console.

Remote Desktop

Remote Desktop allows us to remotely log on to a computer running Windows operating system and work with it as if we were sitting right in front of it. We have a separate article describing Remote Desktop feature in Windows.