How to get a list of systems that have ANY version of a specific app installed?

  • 5 October 2021
  • 3 replies
  • 313 views

Userlevel 2
Badge

I am trying to get a list of hostnames that I can put into Excel for systems that have any version of Google Chrome on them. I know I can go to “software” and type in Chrome and pull a list, but the problem is that it returns results in groups, based on the version of Chrome - and there are about 50 different groups/versions… so to get a list of hosts, I’d have to click into each group and copy the hostname.


Is there a way to get a simple list of hosts from Automox that have ANY version of Chrome installed?


3 replies

Badge

use this script, add your ApiKey and ORG ID, then filter by Google Chrome in the Output


$apiKey = ‘’

$orgID = ‘’

$filepath = ‘C:\Temp\SoftwareInventory.csv’



---------------------------


$page = 0

$limit = 500

$servers = @()


Set-Content $filepath -Value “Computer,display_name,version”


$apiInstance = ‘https://console.automox.com/api/

$apiTable = ‘servers’


while($true) {


$orgAndKey = "?o=$orgID&api_key=$apiKey&l=$limit&p=$page"

# Put components together
$uri = $apiInstance + $apiTable + $orgAndKey

$resp = (Invoke-WebRequest -Method GET -Uri $uri -UseBasicParsing).Content | ConvertFrom-Json | Select-Object results

$servers += $resp.results
$page += 1

if($resp.results.count -lt $limit) {
break
}

}


$servers = $servers | Sort-Object name



Check each server for software


foreach ($server in $servers) {


$serverID = $server.id
$serverName = $server.name

Write-Output $serverName

$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

$response | Where-Object {$.display_name -notMatch “Windows|Intel|Update|Microsoft|Alcor|AMD|Avatier|Avaya|Azure|Barracuda|Bloomberg|BlueMatrix|Bomgar|Brother|Canon|Catalyst Control Center|CCC Help|Cisco|Citrix|CompnentOne|CorelDRAW|Dell|FactSett|Firefox|Global Relay|Greenshot|Hewlett|HP|IIS|Konica Minolta|Logitech|LogMeIn|LogRhythm|Market Axess|MarketResearch|Mozilla Firefox|NVIDIA|Panini|Python|Quickbooks|Realtek|Remote Support Jump Client|Samsung|Service Pack|Slack|Sophos|SQL|Surface|Synaptics|Tradeweb|TRAFiX|Visual C|Visual Studio|VLC|VMware” -and $.installed -EQ $true} | Select-Object @{label=“Computer”; Expression= {"$serverName"}},Display_Name,Version `

| Sort-Object Display_Name | Export-Csv -Path $filepath -NoTypeInformation -Append -Force


}

Userlevel 2
Badge

Thanks… that came across in an odd formating. Are you saying that I should just create a ps1 as this:


$orgId = "myorgidhere"
$apiKey = 'myapikeyhere'
$filepath = ‘.\SoftwareInventory.csv’

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

Set-Content $filepath -Value “Computer,display_name,version”

$apiInstance = ‘https://console.automox.com/api/’
$apiTable = ‘servers’

while($true) {
$orgAndKey = "?o=$orgID&api_key=$apiKey&l=$limit&p=$page"

# Put components together
$uri = $apiInstance + $apiTable + $orgAndKey

$resp = (Invoke-WebRequest -Method GET -Uri $uri -UseBasicParsing).Content | ConvertFrom-Json | Select-Object results

$servers += $resp.results
$page += 1

if($resp.results.count -lt $limit) {
break
}
}

$servers = $servers | Sort-Object name

foreach ($server in $servers) {

$serverID = $server.id
$serverName = $server.name

Write-Output $serverName

$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

$response | Where-Object {$.display_name -notMatch “Windows|Intel|Update|Microsoft|Alcor|AMD|Avatier|Avaya|Azure|Barracuda|Bloomberg|BlueMatrix|Bomgar|Brother|Canon|Catalyst Control Center|CCC Help|Cisco|Citrix|CompnentOne|CorelDRAW|Dell|FactSett|Firefox|Global Relay|Greenshot|Hewlett|HP|IIS|Konica Minolta|Logitech|LogMeIn|LogRhythm|Market Axess|MarketResearch|Mozilla Firefox|NVIDIA|Panini|Python|Quickbooks|Realtek|Remote Support Jump Client|Samsung|Service Pack|Slack|Sophos|SQL|Surface|Synaptics|Tradeweb|TRAFiX|Visual C|Visual Studio|VLC|VMware” -and $.installed -EQ $true} | Select-Object @{label=“Computer”; Expression= {"$serverName"}},Display_Name,Version `
| Sort-Object Display_Name | Export-Csv -Path $filepath -NoTypeInformation -Append -Force

}

and run it? If so, error result as:



The term ‘$.display_name’ is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.


Badge

Basically is this script


Using the standard API call for software packages installed will just give you software installed on a single device referenced by the server ID#. This script will give you software packages installed on every device in an organization referenced by the computer names. By altering the script you can add additional fields - but make sure the Set-Content line reflects all of the fields you add to the Select-Object part of the last line of the script. You’ll also want the Set-Content line to hav…

 

 

 

i just add this in the last $response line to filter some Apps in the report:

 

 

 

$response | Where-Object {$.display_name -notMatch “Windows|Intel|Update|Microsoft|Alcor|AMD|Avatier|Avaya|Azure|Barracuda|Bloomberg|BlueMatrix|Bomgar|Brother|Canon|Catalyst Control Center|CCC Help|Cisco|Citrix|CompnentOne|CorelDRAW|Dell|FactSett|Firefox|Global Relay|Greenshot|Hewlett|HP|IIS|Konica Minolta|Logitech|LogMeIn|LogRhythm|Market Axess|MarketResearch|Mozilla Firefox|NVIDIA|Panini|Python|Quickbooks|Realtek|Remote Support Jump Client|Samsung|Service Pack|Slack|Sophos|SQL|Surface|Synaptics|Tradeweb|TRAFiX|Visual C|Visual Studio|VLC|VMware” -and $.installed -EQ $true} | Select-Object @{label=“Computer”; Expression= {"$serverName"}},Display_Name,Version `

 

Reply