I have a script that checks for installed Adobe components.
It searches the registry. It works fine until you get to a computer that doesn't allow remote registry access.
I tried using the Win32_Product
command. Everywhere on the net they say to avoid this but I can't find any other solution.
The thruth is that besides that it is slow, Adobe is not in the WMI list!
This is the registry method:
$UninstallRegKeys = @(
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
"SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
)
if (Test-Connection -ComputerName $srv -Count 1 -EA 0) {
foreach ($UninstallRegKey in $UninstallRegKeys) {
try {
$HKLM = [microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',$srv)
$UninstallRef = $HKLM.OpenSubKey($UninstallRegKey)
$Applications = $UninstallRef.GetSubKeyNames()
} catch {
$output.appendtext("Failed to read the registry entry. Probably no remote rights!`r`n")
$regfail = 1
continue
}
}
foreach ($App in $Applications) {
$AppRegistryKey = $UninstallRegKey + "\\" + $App
$AppDetails = $HKLM.OpenSubKey($AppRegistryKey)
$AppGUID = $App
$AppDisplayName = $($AppDetails.GetValue("DisplayName"))
if ($AppDisplayName -split ' ' -contains "Adobe") {
$AppVersion = $($AppDetails.GetValue("DisplayVersion"))
$output.appendtext("Name : " + $AppDisplayName + "`r`n")
$output.appendtext("Version : " + $AppVersion + "`r`n")
}
}
This is the Win32_Product method:
$appinfo = Get-WmiObject Win32_Product | Select-Object Name, Version
foreach ($appi in $appinfo) {
if ($Appi.name -split ' ' -contains "Adobe") {
$output.appendtext("Name : " + $Appi.name + "`r`n")
$output.appendtext("Version : " + $Appi.version + "`r`n")
}
}
Any other method on how to find Adobe? I thought also about looking for the Adobe folder but because every version has a different style it might be difficult.