Skip to content

Instantly share code, notes, and snippets.

@jcefoli
Created February 6, 2025 21:19
Show Gist options
  • Save jcefoli/2b2fb48e5e1e11c0b146e81364171ba7 to your computer and use it in GitHub Desktop.
Save jcefoli/2b2fb48e5e1e11c0b146e81364171ba7 to your computer and use it in GitHub Desktop.
Uninstall Splunk Universal Forwarder (Windows)
# Get the list of installed programs
$installedPrograms = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName
$containsSplunk = $installedPrograms.DisplayName -like "*UniversalForwarder*"
if ($containsSplunk) {
Write-Output "[INFO] Splunk found. Removing"
if (Get-Service -Name SplunkForwarder -ErrorAction SilentlyContinue) {
Start-Process -FilePath "C:\Program Files\SplunkUniversalForwarder\bin\splunk.exe" -ArgumentList "stop" -Wait -NoNewWindow
}
$productCode = Get-WmiObject Win32_Product -Filter "name='UniversalForwarder'" | ForEach-Object { $_.IdentifyingNumber }
. msiexec /x$productCode /qn
Write-Output "[INFO] Splunk DELETED!"
}
else {
Write-Output "[INFO] Splunk not found. Skipping"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment