03-03-2023 05:05 PM
This script enables MTP admins to search for 'x' software name and 'y' version on all orgs the MTP admin administers.
Instructions:
1. Edit line 2, $MtpAdminApiKey with your admin API key
2. Edit line 3, $csvPath with the path or folder you want the CSV to be saved in
2. In line 23, modify the Get-JCSystemApp with your desired search parameters ex.
$orgApps = Get-JCSystemApp -name "Google Chrome" -search | Select-Object -Property SystemId, name, Version, BundleVersion
$orgApps = Get-JCSystemApp -name "Firefox" -version "110.0.1" -search | Select-Object -Property SystemId, name, Version, BundleVersion
$orgApps = Get-JCSystemApp -systemOs "Windows" -search | Select-Object -Property SystemId, name, Version, BundleVersion
Script:
###### Modify MTPAdminKey and CSVPath ######
$MtpAdminApiKey = "YOUR_MTP_ADMIN_API_KEY_HERE"
$csvPath = "~/Documents/CSV/mtp_script.csv"
$env:JCApiKey = $MtpAdminApiKey;
$env:JCOrgId = "a";
# Get all MTP orgs
$orgId = Get-JcSdkOrganization | Select-Object -Property Id
# Connect to each org and get the list of apps installed on each system
$orgId | ForEach-Object {
$organizationId = $_.id
Connect-JCOnline -JumpCloudApiKey $MtpAdminApiKey -JumpCloudOrgId $organizationId -force
$systemsInsightsOrg = Get-JcSdkOrganization -id $organizationId
# Check if System Insights is enabled for the org
if ($systemsInsightsOrg.Settings.SystemInsightEnabled -eq $false) {
# output with color yellow
Write-Host "System Insights is not enabled for the orgId: $($systemsInsightsOrg.DisplayName)" -ForegroundColor Yellow
} else {
###### Modify Get-JCSystemApp with desired parameters ######
$orgApps = Get-JCSystemApp | Select-Object -Property SystemId, name, Version, BundleVersion
# Add orgId to the output
$orgApps | Add-Member -MemberType NoteProperty -Name "OrgName" -Value $systemsInsightsOrg.DisplayName
# Save the output to a csv file
Write-Host "Exporting apps for org: $organizationId to mtp_script.csv"
$orgApps | Export-Csv -Path $csvPath -append -NoTypeInformation # Appends to the csv file for each org
}
}
For more information about Get-JCSystemApp, please head to this community post
New to the site? Take a look at these additional resources:
Ready to join us? You can register here.