4

I am starting a new process using:

$removeArguments = "-Command  `"&{import-module .\deploy-utility.psm1; RemoveSolutions -solutionNames $solutionNames -url $url;}`""
start-process powershell -ArgumentList $removeArguments -Wait

This works fine when run locally but when run in remote session the statement is simply ignored.

I have also tried moving the command to a separate file but this makes no difference.

$removeArguments = "-File .\deploy-utility-functions.ps1", "remove", "$solutionNames", "$url"
$script = {start-process powershell -ArgumentList $removeArguments -Wait -NoNewWindow | Out-Host}
Invoke-Command -ScriptBlock $script

Remote call:

$script = [scriptblock]::create("& '.\$targetFile' '$arguments'")
$result = Invoke-Command -Session $s -ScriptBlock $script

Any suggestions?

Martin Nilsson
  • 659
  • 1
  • 8
  • 17

1 Answers1

1

You can have issues with permissions in remote sessions for the second hop ( Permissions of the started process in your case). See enabling credssp http://ss64.com/ps/enable-wsmancredssp.html

James Woolfenden
  • 6,498
  • 33
  • 53