Solved

PowerShell-RestMethod Environment Setup

  • 21 September 2021
  • 6 replies
  • 169 views

Userlevel 1
Badge +6

I’m using this example PS command from https://api.commvault.com/#432b936c-631e-da74-0678-5626f95dc944 to retrieve QSDK token 

 

 

I’m getting this error 

 

icon

Best answer by RMcG 21 September 2021, 23:40

View original

6 replies

Userlevel 7
Badge +23

Hey @MaxJamakovic - any chance to try from another machine? The error seems to indicate an internal PS / framework issue, so just curious to narrow down if there is an issue with the machine the PS command is being run on or an error in the code

Userlevel 1
Badge +6

HI Damian 

I did on CommServ  getting same error 

Userlevel 7
Badge +23

HI Damian 

I did on CommServ  getting same error 

Thanks @MaxJamakovic - I see you have an open support case which is being escalated. There was one other case with the same issue however we lost contact with the customer before it could be resolved - so this is certainly a head scratcher. I’ll see if anyone in the community here has any ideas, specifically @RMcG to see if he can spot something to check.

 

Userlevel 1
Badge +6

Yes I’m working with support, it’s taking so long. CommVault support tested in they environment and it failed, that’s why is escalated 

Userlevel 3
Badge +6

Hi Max,

 

The way you have constructed the body is causing the error. The body needs to be in a valid json format when you are using content-type of application/json. A quick way is to construct a hash table and then convert it to json.

Here’s an example using your script with a couple of lines commented and new ones added…

 

Note: You’ll also need to base64 encode the password before you add it to the body. I have shown a simple way to do that in the screenshot.

 

Userlevel 1
Badge +6

Hi RMcG that worked very well, thank you so much 

 

 

Reply