Код: Выделить всё
$RemoteHost = "computer1"
$Command = "d:\vlc 210.exe"
Invoke-Command -ComputerName $RemoteHost -ScriptBlock {param($Command) cmd.exe /c """$Command"" /L=1033 /S" } -ArgumentList $Command-ScriptBlock
By default, any variables in the command are evaluated on the remote computer. To include local variables in the
command, use the ArgumentList parameter.
Для передачи параметров в удаленную сессию, используем параметр ArgumentList.
Код:
Код: Выделить всё
{param($var1,$var2) Command $var1 $var2}Или $using:variable:
Код:
Код: Выделить всё
{Command $using:var}
не знаю почему