I really like the idea of PowerShell, though the configuration may take a couple of minutes on server and client.
Aside the complete answer of Shanteva, which suggests the use of PowerShell, you should also take a look at Here on howtogeek website on how to actually Enable (and Allow) a remote connection to the PowerShell server. There is a slight bit of configuration required on the server computer.
Two important things you need to do:
(I don't have to mention that you have to do every configuration 'as an administrator' right? Just open PowerShell/cmd 'As an administrator')
- First, enable the WINRM service (the windows application that processes remote commands) on the SERVER.
On the server computer, open PowerShell and run:
Enable-PSRemoting -Force
There is also other way of doing this. You can open a command prompt and run:
winrm -quickconfig
There could be much more configurations to change. No need for now.
- Second, it is noteworthy that the client and server are always trying to authenticate each other. The server wants to make sure the client does actually have allowed access to the server or not. For this sake you are going to provide some authentication information to the server (similar to SSH, you maybe providing Username/Password). Conversely, the client wants to make sure that the server is a trusted one. Different schemes can be used, such as trusting a server who provides a smart public certificate or trusting based on IP address or maybe just trusting everyone!! Again we have the same procedure on SSH where a server can provide some authentication information. (Let's just forget the SSH details for now.)
If both computers are on the same 'domain' (a group of computers which everyone have different rules and roles assigned to), the procedure seems to be simple (I haven't tried that).
BUT, as you probably want to access your server through Internet (technically called the WAN network), there are some complications and you have to change some configuration to allow the connection to the remote server. On the CLIENT computer enable the WINRM service. The procedure is similar to what we've done for server above. Just run the command:
Enable-PSRemoting -Force
(Again noteworthy! Some references say that the client computer and the server computer must be on 'Private' networks, or the whole thing won't work. I'm getting error messages for this when I run the above command but everything works find. I'm not sure of this fact. Check the aforementioned web page.)
Then run on the CLIENT computer in PowerShell:
Set-Item wsman:\localhost\client\trustedhosts *
Which means that the client will trust all servers (hosts). Finally, run this (on the CLIENT again I emphasize):
Restart-Service WinRM
You are ready to go. Check rest of Shanteva's answer. On the CLIENT computer, run for instance:
Enter-PSSession -ComputerName 12.34.56.78 -Credential Administrator
It will ask for a password and the remote console opens which looks like:
[12.34.56.78]: PS C:\Users\Administrator\Documents>
Then just enter commands like you do for SSH.