Invoke Powershell: AuthToken in the request is invalid. Unable to authenticate

Hi. I’m invoking a Powershell Script but I’m getting an error on the Orchestrator.

Invoke Power Shell: {“response_status”:{“status_code”:4000,“messages”:[{“status_code”:401,“type”:“failed”,“message”:“AuthToken in the request is invalid. Unable to authenticate.”}],“status”:“failed”}}

Can you tell me what’s wrong? I requested a new API key since I thought that the API key was expired but it’s still giving the same error.

Try to use the Fiddler Classic and inspect the RestAPI calls which are made in the backend for the powershell code without Studio and the one with Studio and observe the Requests differences in the header and in the Payload.

After finding the differences in the call, you will know where you need to dedicate your attention in the Invoke Powershell activity code.