Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
IdentityNow Certification Completion Status Reports. Associated Blog Post located here
$orgName = "myIDNOrg"
# Get Campaign Base URI
$GetCampaignBaseURI = "https://$($orgName)"
# Get Reports Base URI
$getReportsBaseURI = "https://$($orgName)"
# Get Completed Campaigns and Reports
$csvStatusReportBaseURI = "https://$($orgName)"
# List Campaign Base URI
$GetCampaignBaseURI = "https://$($orgName)"
# Export Reports from the last x Days
$daystoExport = "7"
$utime = [int][double]::Parse((Get-Date -UFormat %s))
# Completed Campaigns
$completedOnly = $true
$campaigns = 100
# Get Campaigns
$existingCampaigns = Invoke-RestMethod -method Get -uri "$($GetCampaignBaseURI)?_dc=$($utime)&completedOnly=$($completedOnly)&start=0&limit=$($campaigns)" -WebSession $IDN
foreach ($campaign in $existingCampaigns.items) {
# Get time of completion of the Campaign
$unixtime = $null
[string]$unixtime = $campaign.deadline
$unixtime = $unixtime.Substring(0, 10)
$time = [timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($unixtime))
$accesst = $idn.Headers.authorization.split(" ")
if ($time -gt (get-date).AddDays(-$($daystoExport))) {
$campaignReports = $null
$campaignReports = Invoke-RestMethod -Method Get -Uri "$($getReportsBaseURI)?_dc=$($utime)&campaignId=$($" -WebSession $IDN
foreach ($report in $campaignReports) {
if ($"Campaign Status Report")) {
write-host -ForegroundColor Green "The $($campaign.description) campaign is of type $($campaign.type) and was completed on $($time.Date.Day)/$($time.Date.Month)/$($time.Date.Year) with $($campaign.totalCertifications) certification(s)."
# Get CSV Report
$outputFile = "c:\temp\SailPointCampaignReports\$($campaign.description)-StatusReport.csv"
$report = Invoke-RestMethod -Method Get -Uri "$($csvStatusReportBaseURI)/$($report.taskResultId)?format=csv&name=Export+Campaign+Status+Report&url_signature=$($accesst[1])" -WebSession $IDN
# Output Report to filesystem
$report | out-file $outputFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.