Skip to content

Instantly share code, notes, and snippets.

@gioxx
Last active April 8, 2025 08:27
Show Gist options
  • Save gioxx/b523f4d571445678e06c8a690e448e9a to your computer and use it in GitHub Desktop.
Save gioxx/b523f4d571445678e06c8a690e448e9a to your computer and use it in GitHub Desktop.
Finds the download URL for IntuneWindowsAgent.
<#
.SYNOPSIS
Finds the download URL for IntuneWindowsAgent.
.DESCRIPTION
This script retrieves the download URL for IntuneWindowsAgent from the registry.
It checks the registry path for the specified subkeys and retrieves the DownloadUrlList and ProductVersion properties.
.EXAMPLE
.\FindIMEDownloadURL.ps1
This command runs the script to find the download URL for IntuneWindowsAgent.
.NOTES
Author: Giovanni Solone
Date: 2025/04/08
Modification history:
- 2025/04/08: check if the base registry path exists and exit from the script if it doesn't. Same for the subkeys.
#>
$baseRegistryPath = "HKLM:\SOFTWARE\Microsoft\EnterpriseDesktopAppManagement\S-0-0-00-0000000000-0000000000-000000000-000\MSI"
try {
if (-not (Test-Path $baseRegistryPath)) {
Write-Error "Registry base path not found: $baseRegistryPath"
return
}
} catch {
Write-Error "Failed to access registry path: $_"
return
}
try {
$subKeys = Get-ChildItem -Path $baseRegistryPath
} catch {
Write-Error "Failed to retrieve subkeys from registry path: $_"
return
}
$results = @()
foreach ($subKey in $subKeys) {
$downloadUrlList = (Get-ItemProperty -Path $subKey.PSPath -Name "DownloadUrlList").DownloadUrlList
$productVersion = (Get-ItemProperty -Path $subKey.PSPath -Name "ProductVersion").ProductVersion
if ($downloadUrlList -is [array] -and $downloadUrlList.Length -eq 1) {
$downloadUrlList = $downloadUrlList[0]
} else {
$downloadUrlList = ($downloadUrlList -join ", ").TrimEnd(", ")
}
# if $downloadUrlList contains "IntuneWindowsAgent", then add to $results
if ($downloadUrlList -like "*IntuneWindowsAgent*") {
$results += [PSCustomObject]@{
SubKey = $subKey.Name
DownloadUrlList = $downloadUrlList
ProductVersion = $productVersion
}
}
}
$results | Format-Table -Property DownloadUrlList, ProductVersion | Sort-Object ProductVersion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment