Comparing Risk Scores in the API

PingCastle Pro and Enterprise have always had a history feature to look at your old reports and compare them.

A customer recently asked if we could help them extract score differences in the tool and to log a feature request to add it (Note: Were already planning to improve the report comparision feature and we will look into adding this as well!).

To help them do this we need to use the API which is documented by swagger in PingCastle Pro and Enterprise at /swagger.

To run this you just need to get an Agent API Key with read access to all data and download and run the script attached.

Compare-PingCastleRiskScore.ps1 (12.3 KB)

.\Compare-PingCastleRiskScore.ps1 -ServerName "<Your PingCastle Server Name>" -ApiKey (ConvertTo-SecureString -AsPlainText -Force -String "<Your_API_Key>") -All

By default it will do 6 months but you can do days/weeks/months with the TimeFrameUnit and TimeFrameValue options. For Example to do two weeks you would add the following to the command -TimeframeUnit Weeks -TimeFrameValue 2

Also if you only wanted a single or subset of domains you can provide the -DomainName or -DomainSid parameters instead of the -All parameter and it will just retrieve the ones you want.

You can see here in the screenshot different ways to use this to track the changes.
Note: The reason the risk scope did not change for anomalies for the resolution of this is because it is still over the 100 maximum but you can see that a risk was fixed and the score change associated with it.

Hope this is useful to some of you :slight_smile:

2 Likes