Interactive PingCastle dashboard

Simple use case.

PingCastle is an open source Active Directory Auditing tool, to find weaknesses in your AD’s.

I run a report weekly, to track progress, and find new issues.
While the reports themselves are ok-ish. having charts to display data just makes stuff better.

To retrieve numbers from the generated XML, I use this function

function Get-PingCastleXMLRuleData {
    param(
        [string]$XMLfilepath
    )
    if(test-path $XMLfilepath){
        [XML]$CurrentReport = get-content $XMLfilepath
        $CurrentReport.HealthcheckData.RiskRules.HealthcheckRiskRule | ForEach-Object {
            [pscustomobject]@{
                Points    = $_.Points
                Category  = $_.Category
                Model     = $_.Model
                RiskId    = $_.RiskId
                Rationale = $_.Rationale
                Details   = $_.Details.string
                Sourcepath = $XMLfilepath
                SourceDomain = $CurrentReport.HealthcheckData.DomainFQDN
            }
        }
    }
    else{
        write-error "Path not found"
    }
}

in the HTML report we can find the description and problematic objects, but parsing the reports can be a little icky.
I used the code below to run through all my old reports, and a variations hereof in my script the generate reports.

$PingReports = Get-ChildItem .\Reports -Recurse -Include "*.xml"

Foreach($PingReport in $PingReports){

    $HTMLFile = (Get-item $(($PingReport.DirectoryName) + "/" + $($PingReport.BaseName) + ".HTML"))
    $HTMLFileFolder = Get-item $HTMLFile.Directory

    [XML]$CurrentReport = get-content $PingReport

    New-Item -ItemType Directory -Path $HTMLFileFolder -Name $CurrentReport.HealthcheckData.DomainFQDN -ErrorAction SilentlyContinue
    $detailspath = $HTMLFileFolder.FullName + "\" + $CurrentReport.HealthcheckData.DomainFQDN
    New-Item -ItemType Directory -Path $detailspath  -Name "Details" -ErrorAction SilentlyContinue

    $source = Get-Content $HTMLFile -Raw
    $html = New-Object -ComObject "HTMLFile"
    $src = [System.Text.Encoding]::Unicode.GetBytes($source)
    $html.write($src)
    foreach ($Riskrule in ($CurrentReport.HealthcheckData.RiskRules.HealthcheckRiskRule.riskid)){
        $divId = "rules$Riskrule"

        $div = $html.getElementById($divId)
        $div.innerHTML # save this how you like - i store them in a date based folder structure as $Riskrule.html

    }
}

The “innerhtml” is displayed directly in a modal when clicking the Details button.

Where can i learn more about his product?

PingCastle?

Home - PingCastle

its an open source Active directory “Risk analyzer/Audit” tool.
you don’t need any special rights to run it. Just download it to a domain joined pc and run it.

PingCastle.exe --healthcheck

I initially build the dashboard because the report charts only go to 100 even if the score is higher - which means initial progress may not be visible to higher-ups.

1 Like

@PorreKaj , Thank you for this.