PowerShell Get-Report cmdlet write to PDF file

@RandomUser4096 I found a solution to this. I too noticed that writing to PDFs was problematic. My workaround was to not use the Get-Reports cmdlet and instead use Invoke-RestMethod so that you can utilize the -outfile parameter.

Here’s a script sample

$report_id = "REPORT_ID_HERE"

$token = Get-IDNAccessToken
$baseurl = (Get-DefaultConfiguration).BaseUrl

$headers = @{
    Authorization = "Bearer $($token)"
}

$uri = "v3/reports/$($report_id)?fileFormat=pdf"
    
Invoke-RestMethod -Method "GET" -Headers $headers -Uri ($baseurl + $uri) -OutFile "C:\Temp\campaign_report.pdf"

I updated my full script here