Cant retrieve exit code from Powershell script in OO

Hello ,

I am using a PowerShell script located in /Base\[1.23.5]/Library/operations/Remote Command Execution/Powershell/Powershell Script,

simply trying to run the following commands in script input:

dir d:\

exit 13

even dir command is not working when there is exit   

operation itself ends as a failure, saying "Could not execute PowerShell command"  i cant get exit code or $lastexitcode.

need help about it ,

Thanks in advance

  • 0  

    There can be many reasons why Poweshell fails to execute on a remote host. Please check the notes in the /Base\[1.23.5]/Library/operations/Remote Command Execution/Powershell folder properties. Those should get you started.

    Although I am an OpenText employee, I am speaking for myself and not for OpenText.
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button

  • 0 in reply to   

    Hi kumitikka,

    Thank you for your response.

    As you suggested , i checked the notes area.
    I saved the same script as .ps1 file on the remote machine.When i call it as D:\script.ps1 , i can get the exit code.However , as i mentioned above , when i write script directly in the script area it doesnt work.
    The notes area mentions that if returnTable value is false the operation appends the out-string command to the end of script. I think this is the problem. When i write exit 13 command , somehow out-string command doesnt work and the script throws an error. I tired all combinations with returnTable and hideResult input but i still couldnt get the exit code.

    Thanks in advance.