Using Powershell on one computer to run a Powershell script on another computer

This may be really obvious since I'm new to Powershell, but what is the best way to run a Powershell script on one computer that calls another to run a Powershell script on this? I use V2.0 if that matters.

+3
source share
1 answer

First you need to turn on the remote computer on the remote computer. Log on to this computer and from an elevated prompt (admin) run:

Enable-PSRemoting -Force

Invoke-Command . script , , pssession (New-PSSession) , , Invoke-Command, :

$s = new-PSSession -computername (import-csv servers.csv) `
                   -credential domain01\admin01 -throttlelimit 16
invoke-command -session $s -scriptblock {get-process powershell} -AsJob

, (admin), . , about_remote (man about_remote).

+6

Source: https://habr.com/ru/post/1753379/


All Articles