1

I recently had to start managing remote Windows 10 systems (non-servers) and am curious if there is an SSH equivalent for running command prompt commands remotely.

Is there a default utility for doing this?

2

1 Answer 1

1

The comments mention windows builds of SSH, but the actual equivalent for managing windows systems from windows is Powershell sessions. Here's a few good starting points:

Enable-PSRemoting: Configures a PC to accept PS Sessions: Opens a firewall port, verifies the service is running, etc.

Enter-PSSession is the equivalent to a normal ssh command. It connects to the remote machine, starts a Powershell prompt, and streams it back to your terminal:

Enter-PSSession Win10PC
# Equivalent to 
ssh MyUsername@Win10PC

# Prompt will look like this to show you're in the remote PC:
[Win10PC]: PS C:\WINDOWS\system32> 

Invoke-Command uses the same remote session process, but just runs the command you give it and sends you the result (better for scripts):

Invoke-Command -ComputerName Win10PC -ScriptBlock {Get-PSDrive}

Like SSH, Powershell will use the current user to connect to the remote machine, and run as admin if possible. To run as a different user, add the -Credential flag

Enter-PSSession Win10PC -Credential (Get-Credential)

This doesn't require that you be in a windows domain, but it will work a lot better if you are.

2
  • I only mentioned OpenSSH, due to the other's asking for an SSH equivalent on Windows, which of course is OpenSSH.
    – Ramhound
    Commented Jan 21, 2021 at 21:04
  • official document
    – XoXo
    Commented Oct 20, 2022 at 12:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .