Skip to content

Instantly share code, notes, and snippets.

@CarissaDurko
Created July 7, 2025 18:54
Show Gist options
  • Select an option

  • Save CarissaDurko/fac4f074a41ce179856b0531e34b418a to your computer and use it in GitHub Desktop.

Select an option

Save CarissaDurko/fac4f074a41ce179856b0531e34b418a to your computer and use it in GitHub Desktop.
Tenable Detection PowerShell Script
$msiProductCodes = @(
'{GUID}'
)
$paths = @(
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
)
foreach ($path in $paths) {
foreach ($guid in $msiProductCodes) {
$fullKey = Join-Path $path $guid
if (Test-Path $fullKey) {
$uninstallString = (Get-ItemProperty -Path $fullKey).UninstallString
if ($uninstallString) {
if ($uninstallString -like "msiexec*") {
$uninstallString += " /qn /norestart"
}
$exe, $args = $uninstallString -split ' ', 2
$exe = $exe.Trim('"')
Start-Process -FilePath $exe -ArgumentList $args -NoNewWindow -WindowStyle Hidden -Wait
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment