Especially with the option to install Server Core in Server 2008 and above, connecting to Windows servers over a CLI
is increasingly useful ability, if not one that's very widespread amongst Windows administrators.
Practically every Windows GUI
management tool has an option to connect to a remote computer, but there is no such option present in the built-in Windows CLI
(cmd.exe
), which gives the initial impression that this might not be possible.
Is it possible to remotely management or administer a Windows Server using a CLI? And if so, what options are there to achieve this?
There are several fairly easy options available for remotely managing a remote Windows Server using a command line, including a few native options.
Native Options:
cmd.exe
, which creates an interactive command line on the remote system, rather than as command line option to execute a single command on a remote server.winrs -r:myserver.mydomain.tld cmd
BSD
, etc.) that are primarilyCLI
-based.PowerShell
needs no introduction, and can be used to manage remote computers from aCLI
usingWMI
(Windows Management Instrumentation).WMI
+PowerShell
for remote management, such as The Scripting Guy's blog, the MSDN WMI Reference and ss64.com, which has an index of PowerShell 2.0 commands.CLI
option, but of course, usingmstsc.exe
to connect to a server over Remote Desktop Protocl (RDP
) does enable the use of a command line on the remote server.RDP
, is actually possible and will give the same interface as connecting to the console - an instance ofcmd.exe
.RDP
, should one be so inclined.Popular, Non-Native Options:
Even though Windows now provides a few native options for accessing a remote sever over a
CLI
, this was not always the case, and as a result, a number of fairly popular 3rd party solutions were created. The three most notable are below.Install SSH on your Windows Server
SSH
, that's an option too, and there's a guide on social.technet for how to install OpenSSH on Server 2008.BSD
, etc.) that make heavy use ofSSH
for this purpose, though there are advantages to even Windows-only administrators for having a single terminal emulator client (like PuTTY) store a number of target computers and customized (or standardized) settings for each.PSExec
CLI
, this is part of the excellent SysInternals suite. One of the very few "must have" packages for Windows admins, the SysInternals tools were so widely respected and used that SyInternals was bought out by Microsoft, and the tools are now somewhat officially supported by Microsoft.WinRS
/RM
,PSExec
can be used to issue single commands to a remote server, or to launch an interactive instance ofcmd.exe
on a remote computer.psexec \\myserver.mydomain.tld cmd
Add a utilities folder to the server and store its value in the %PATH% system variable
%PATH%
environmental variable of your systems. Both are easily done throughGPO
.CLI
, but I find it so useful I think it's worth including anyway.Just for the sake of completeness: although it might not be the best solution for various reasons, every Windows system supports the Telnet service, which can be enabled from the features list.
Microsoft's telnet implementation also supports NTLM authentication, thus, unlike standard telnet to a Unix system, no clear-text password is sent on the network when using it.