Use API for a Count of All Software Installed in an Organization (with Pagination)

This API call will generate a list of all software in your organization and a count of how many are installed of each. Just update your API key, org ID, and where you want the file saved. It will overwrite an existing file if it exists.

It also shows how you can use pagination to account for more than 500 results.

$apiKey = 'YOUR_API_KEY'
$orgID = 'YOUR_ORG_ID'
$filepath = "C:\Temp\packages.csv"

$page = 0
$limit = 500
$data = @()

Write-Output "Page"

while($true) {
    $headers = @{"Authorization" = "Bearer $apiKey" }
    $url = "https://console.automox.com/api/orgs/$orgID/packages?l=$limit&p=$page"
    $response = (Invoke-WebRequest -Method Get -Uri $url -Headers $headers).Content | ConvertFrom-Json
   
    Write-Output $page
    $data += $response
    $page += 1

    if($response.count -lt $limit) {
        break
    }
}
$data | Group-Object display_name | Sort-Object name | Select-Object Count,name `
      | Export-Csv -Path $filepath -NoTypeInformation
1 Like