Jump to content

Updating Password in Powershell Issue


Recommended Posts

Hi, I've been working with passwordstate and powershell to create an automated password management script. I've so far been able to create, retrieve, and delete passwords from our server, but am unable to update an existing password. I've been using the following code:

 

 
   $JSONSTRING = @{
       "PasswordID"=$PWD_ID
       "PasswordListID"=$PWD_LIST_ID
       "GenericField2"="Active"
   }
   Invoke-Restmethod  -Uri "$PASSWORDSTATE_SERVER/api/passwords" -Method PUT -ContentType "application/json" -Header @{"APIKey"=$APIKEY} -Body $JSONSTRING 
 
This syntax works for all the other password methods, but for this method gives me the following error:
"Invalid API call - No compatible API route found, "Please check for valid request URLS, parameters, and http verbs."
 
To my knowledge, this code should work, as I'm following the tutorial set in the passwordstate api documentation, and again it works for other methods. Does anyone see something I'm missing?
 
Thanks!
Link to post
Share on other sites

Hi jcoughlan,

 

Sorry, I've just noticed a couple more issues with the jsonString. Can you try the following:

 

$JSONSTRING = '{
       "PasswordID":' + $PWD_ID +',
       "GenericField2":"Active"
   }
'
 
I've just tested this, and it appears to be working for me now.
 
Regards
Click Studios
Link to post
Share on other sites

Hi jcoughlan,

 

Can you tell me what build of Passwordstate you're using - this worked for us, so possibly it's a bug in an older build.

 

We may need to organise a Remote Desktop session to try and help troubleshoot this further with you. Can you contact us via the following page so we can organise a time - http://www.clickstudios.com.au/support.aspx

 

Thanks

Click Studios

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...