Software Install List of Devices Using PowerShell
Use a PowerShell script to retrieve a list of devices that have a unique software package installed. This list includes the version number on the export file, but the search is done using the software package name.
This example output uses a search for Microsoft Edge Chromium:
There are four areas in the code that you’ll need to update to get the script to function:
-
$orgID = 'YOUR_ORG_ID'
You will need your Org ID, which can be found by looking at the URL. Select the value after the
?o=
-
$apiKey = 'YOUR_API_KEY'
In your console, go to Settings → Secrets & Keys and select the API key.
Note: The API key is per user. Each user will have a unique set of API keys.
$filePath
You can also modify$filepath
if you want to change the file name or save it in a different location. Keep in mind the script will overwrite a previously generated file if it exists.
$appInstalled = 'APPLICATION'
Enter the name of the application as it is listed in the software section of a device’s page that has it installed. See Software Associated with a Device in Device Details.
Software List of Devices Script
Use this script to pull an inventory of devices that have a unique software package installed.
$apiKey = 'YOUR_API_KEY'
$orgID = 'YOUR_ORG_ID'
$appInstalled = 'Microsoft Edge'
$filepath = 'C:\Temp\AppInstalled.csv'
Set-Content $filepath -Value "Computer,Name,Version"
$apiInstance = 'https://console.automox.com/api/'
$apiTable = 'servers'
$orgAndKey = "?o=$orgID&api_key=$apiKey"
# Put components together
$getURI = $apiInstance + $apiTable + $orgAndKey
# Get the json body of the Web Request
$jsonReturn = (Invoke-WebRequest -UseBasicParsing -Method Get -Uri $getURI).Content
# Convert to object with manipulatable properties/values
$servers = $jsonReturn | ConvertFrom-Json
$servers = $servers | Sort-Object name
# Check each server for software
foreach ($server in $servers) {
$serverID = $server.id
$serverName = $server.name
$orgAndKey = "/$serverID/packages?o=$orgID"
# Put components together
$getURI = $apiInstance + $apiTable + $orgAndKey
$headers = @{ "Authorization" = "Bearer $apiKey" }
$response = (Invoke-WebRequest -Method Get -Uri $getURI -Headers $headers).Content | ConvertFrom-Json
$installed = $response | Where-Object {$_.installed -EQ $true -and $_.display_name -EQ $appInstalled}
$output = $serverName + "," + $installed.display_name + "," + $installed.version
$output | Add-Content -Path $filepath
}