Jump to content

Password Reset Dependency - Update multiple records with the same password


Recommended Posts

Topic:

In this forum post we'll describe how you can update multiple records with the same password, by using a Password Reset Dependency and a Powershell API script.  Passwordstate has the ability to copy and link password records between two Password Lists, but this means everything with these two records is identical, including the username.

 

If you have some requirement to have the same password to log into two different systems, but with different usernames, this forum post will guide you how to do this.

 

First, let's take a look at these two Password Records.  Our goal here is to trigger a reset on "Passwordstate Service Account" record, and then have our API script automatically update the "Passwordstate Sharepoint Account" password to be the same value.  Take note of the PasswordID for this second record:

2022-03-21_8-16-21.png

 

Now, let's browse to the Powershell Password Resets page:

2022-03-21_8-29-08.png

 

Add a new Blank Script:

2022-03-21_8-29-50.png

 

And then click on this new script to open the editor.  Paste in the code of your choice.  The code in this screenshot below will be copied in at the end of this post for your reference. In the screenshot below, you can see you have a number of Variables you can insert into your script.  These values are pulled directly from the master Password Record, and in this example, I'll be using the [NewPassword] variable.  This just means, when the password for the master record is reset through the User Interface, then that new password it is reset to will be passed to your script:

2022-03-21_9-43-11.png

 

We'll now add in a new Password Reset Dependency on the master record:

2022-03-21_8-35-18.png

 

Click the Add Dependency button:

2022-03-21_8-47-12.png

 

And select the Custom Script you wrote.  Also, ignore the Windows Account Dependency type, and Save this config:

2022-03-21_8-47-28.png

 

The Master Password now has "1" dependency, and triggering a Password Reset on this master record will proceed as per normal and queue up the reset.  In this example, it's also going to reset the password for the account in Active Directory:

 

2022-03-21_8-48-15.png

 

Once the master password has successfully reset, it will trigger your Powershell API Script, which  in turn triggers a new password reset on the Sharepoint account:

 

2022-03-21_9-07-58.png

 

And the end result of the two successful Password Resets, means these two separate accounts, will have the same password:

2022-03-21_9-30-57.png

 

 

Powershell Code to Update an Existing Password, using the Standard API (Requires API Key)

 

$PasswordstateUrl = "https://passwordstate.clickdemo.com"


# Define values for the Password List in below array
$Body = @{
    PasswordID           = "1045"
    Password           = [NewPassword]
}

# Convert Array to Json
$jsonData = $Body | ConvertTo-Json

# Execute the command
$FullUrl = "$PasswordstateUrl/api/passwords"
Invoke-Restmethod -Method Put -Uri $FullUrl -ContentType "application/json" -Body $jsonData -Header @{ "APIKey" = "8c5423d3e9a7bf6ad6cf8e457392b3d6" } 

 

 

Regards,

Support

2022-03-21_8-29-50.png

2022-03-21_8-29-08.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...