Jump to content

Getting Password History for all shared Password Records


Recommended Posts

This script in Powershell will retrieve all shared password record, then loop through them and get any changes made to each record. It will then export the data to a csv file for easy sorting/reading. You only need to modify the first three lines in the script. 


Line 2 is your Passwordstate URL

Line 3 is your System Wide API key which can be found/generated under Administration -> System Settings -> API tab

Line 4 is the full path to a csv file on your system.  The script will create the csv file for you, you don't need to create it before hand.  You just need to set a valid path.


# Start Script

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

$APIKey = "6ab8dc9437f532eeb36d2f54c38a7948"

$CSVFile = "C:\Data\Local Temp\History.csv"


#Don't modify anything beneath this line


$RecordUrl = "$PasswordstateURL/api/passwords/?QueryAll&PreventAuditing=true"

$Records = Invoke-Restmethod -Method GET -Uri $RecordUrl -Header @{ "APIKey" = $APIKey }


foreach ($Record in $Records)

$ID = $Record.PasswordID

$HistoryUrl = "$PasswordstateURL/api/passwordhistory/$ID"

$results = Invoke-Restmethod -Method GET -Uri $HistoryUrl -Header @{ "APIKey" = $APIKey }

$results | export-csv -Path $CSVFile -append


# End Script



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
  • Create New...