Remote computer management in Windows Powershell

There are 2 ways to execute commands on Remote systems.

  1. Invoke-Command
  2. Enter-PSSession

Here is the example of Invoke-Command in Powershell. In below example, We are executing the command “Get-Process” on computer “C1”.

> Invoke-Command -Scriptblock {Get-Process} -ComputerName C1

Here is the syntax of “Enter-PSSession” command. Once you are connected to remote computer, you can execute commands on that system just like SSH.

> Enter-PSsession -ComputerName C1

To exit the session, you can use below command.

> Exit-PSsession

You may also like...