I have a workflow command step that actually works and completes all the required actions of that command step but throws the following error causing the step to show up as failed in the workflow and not continuing. The command step uses invoke-command to launch a batch file that uses psexec to launch a powershell script remotely on another server.
The error is:
I just want that error to go away so the command step shows as completed successfully and continues on, especially since it really did complete its required action successfully. I've tried redirecting to null with 2>$null and also | Out-Null and also a try catch block that doesn't throw the error execption message.
I understand that powershell invoke-command and pssession allows me to execute powershell commands remotely however I have tried numerous times to make it work that way without any success, it seems to need an actual logged in session before executing the powershell script and psexec has been the only way I've been able to make it work.
Without looking at the code, its difficult to point why is this error thrown. If you are sure that despite this error exception, your tasks get done, and its only a matter of ignoring this exception you can try to use -ErrorAction SilentlyContinue on the Invoke-Command
If this doesn't resolve it, the code would need to be debugged to remove the root cause.
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
I tried the silently continue route as well and it still errors out with the same error message. The code is below, the error gets generated by the Invoke-Command from the ScriptBlock. Do you have any other suggestions I could try?