Hello, I’m looking for a way to call powershell.exe from a PSEXEC “like” process but it hangs or doesn’t appear to be sending the errorlevel that the parent proces is waiting for.
I tried piping “echo.” to it as suggested in the above article but then the command doesn’t run. When it hangs it does execute my command it just never tells the parent process it completed. Are there any special commands to force that errorlevel or to force it to send the exit code to the parent process?
Here is the command that is the “payload”
Get-Service -DisplayName DSM* | Start-Service
I’m doing
powershell.exe -Command {Get-Service -DisplayName DSM* | Start-Service}I know it executes because I am logged on locally and I can see the services do start but it never closes the powershell.exe process nor does the parent process ever close causing my API to log it as an error and cuases 2 processes running on the server that never close.
-VERN