Created
February 6, 2025 21:19
-
-
Save jcefoli/2b2fb48e5e1e11c0b146e81364171ba7 to your computer and use it in GitHub Desktop.
Uninstall Splunk Universal Forwarder (Windows)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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