Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save CarissaDurko/db0480125843098dfead5494406d62b8 to your computer and use it in GitHub Desktop.
Tenable Uninstall PowerShell
# Single MSI GUID to remove
$guid = '{GUID}'
# 1) Stop any Tenable/Nessus services so the MSI can uninstall cleanly
# Adjust the service names as needed for your environment.
Get-Service -DisplayName '*Tenable*','*Nessus*' -ErrorAction SilentlyContinue |
Stop-Service -Force -ErrorAction SilentlyContinue
# 2) Run the silent uninstall
Write-Output "Starting uninstall of $guid..."
$proc = Start-Process -FilePath 'msiexec.exe' `
-ArgumentList "/x $guid /qn /norestart" `
-Wait -PassThru
# 3) Capture and interpret the exit code
$rc = $proc.ExitCode
Write-Output "msiexec returned exit code $rc"
switch ($rc) {
0 { Write-Output "→ Uninstall succeeded (0)"; exit 0 }
3010 { Write-Output "→ Uninstall succeeded but reboot required (3010)"; exit 3010 }
1605 { Write-Warning "→ Product not installed (1605) — treating as success"; exit 0 }
1618 { Write-Warning "→ Another install in progress (1618) — will retry later"; exit 1 }
1601 { Write-Warning "→ Installer service inaccessible (1601)"; exit 1 }
default {
Write-Warning "→ Uninstall failed with unexpected code $rc"
exit 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment