################### # Script Settings # ################### # Set all or part of the Check Group name that you want to report on. Leave it blank if you want to return all checks. $groupName = "Backups" # Set the path to the .html file where you want the results to be exported to if ($groupName -eq "") { $destinationHTMLFile = "CheckCentral Report.html" } else { $destinationHTMLFile = "CheckCentral Report - $groupName.html" } # This is the API token for the demo organization. Change it to your API Token. $apiToken = "c4cbad18272b44c5812668e837f32d85" # Set the header and styles for the generated HTML $HTMLStart = " CheckCentral Report - $groupName " ################################ # Don't modify below this line # ################################ # Get the org name $orgOverview = Invoke-WebRequest -Uri "https://api.checkcentral.cc/getOverview/?apiToken=$apiToken" -UseBasicParsing | ConvertFrom-Json $orgName = $orgOverview.Organization.Name # Get the data for all checks $allChecks = Invoke-WebRequest -Uri "https://api.checkcentral.cc/getChecks/?apiToken=$apiToken" -UseBasicParsing | ConvertFrom-Json # Build the table header $tableColGroup = "" $tableHeaderTitles = "IDNameDescriptionEmail AddressGroupStatusUpdated" $tableHeader = [System.Text.StringBuilder]::new() [void]$tableHeader.Append("") [void]$tableHeader.Append($tableColGroup) [void]$tableHeader.Append($tableHeaderTitles) # Generate the HTML body with the table and check data $HTMLBody = [System.Text.StringBuilder]::new() [void]$HTMLBody.Append("

$orgName`: $groupName

") [void]$HTMLBody.Append($tableHeader) foreach ($check in ($allChecks.checks | where {$_.Group -like "*$groupName*"})) { $checkID = $check.Id $checkName = $check.Name $checkDescription = $check.Description $checkEmail = $check.Email $checkGroup = $check.Group $checkStatus = $check.Status $checkUpdated = $check.Updated [void]$HTMLBody.Append("`n") } [void]$HTMLBody.Append("
$checkId$checkName$checkDescription$checkEmail$checkGroup$checkStatus$checkUpdated
") # Close out the HTML $HTMLEnd = "" # Output the data to the HTML file $HTMLFinal = [System.Text.StringBuilder]::new() [void]$HTMLFinal.Append($HTMLStart) [void]$HTMLFinal.Append($HTMLBody) [void]$HTMLFinal.Append($HTMLEnd) $HTMLFinal.ToString() | Out-File $destinationHTMLFile