Sample code to extract the data (two 'for' loops, this might be my worst PowerShell code ever):
# To retrieve the PCs on which a certain Intune application has been installed
$applications = Get-MgDeviceAppManagementMobileApp
# in this example filtering all apps with 'java' in the name
$apps = $applications | Where-Object { $_.DisplayName -like "*java*" }
foreach($app in $apps) {
Write-Host "Application ID: $($app.Id), Display Name: $($app.DisplayName)"
$reportUrl = "https://graph.microsoft.com/beta/deviceManagement/reports/getDeviceInstallStatusReport"
$body = @{
"filter" = "ApplicationId eq '$($app.Id)'"
} | ConvertTo-Json -Depth 100
# or use 'Invoke-RestMethod'
$report = Invoke-MSGraphQuery -URI $reportUrl -Method POST -recursive -Body $body
$schemaColumns = $report.Schema
$reportValues = $report.Values
# Initialize an array to hold the custom objects
$exportData = @()
# loop through all the entries
for ($i = 0; $i -lt $reportValues.Length; $i++) {
$currentEntry = @{}
for ($j = 0; $j -lt $schemaColumns.Length; $j++) {
# Create a property for each column in the schema
$currentEntry[$schemaColumns[$j].Column] = $reportValues[$i][$j]
}
# Add the current entry as a custom object to the export array
$exportData += New-Object PSObject -Property $currentEntry
}
# Export the collected data to a CSV file
$exportData | Export-Csv -Path "C:\temp\getDeviceInstallStatusReport.csv" -NoTypeInformation -Append
}