Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Start-process exit code 1.

$
0
0

$cred = get-credential
Invoke-Command -ComputerName server01 -Credential $cred -ScriptBlock { 
$exit = Start-Process powershell.exe -ArgumentList 'c:\temp\managescomagent.ps1 -action add -gwname autodetect -envname prod' -Wait -PassThru
$exit.exitcode }

The code outputs exit code 1 and fails to install when run remotely.

If I manually run this on server01, it works.
$exit = Start-Process powershell.exe -ArgumentList 'c:\temp\managescomagent.ps1 -action add -gwname autodetect -envname prod' -Wait -PassThru
$exit.exitcode

Also, any other command like hostname works from invoke-command

$cred = get-credential
Invoke-Command -ComputerName server01 -Credential $cred -ScriptBlock { 
hostname }

What am I doing wrong?



99upgrade




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>