Add a retry for SplunkForwarder stoppage
Attempt at fixing https://github.com/clong/DetectionLab/issues/243
This commit is contained in:
@@ -9,7 +9,13 @@ $targetContent = get-content c:\vagrant\resources\splunk_forwarder\inputs.conf
|
||||
if ($currentContent -ne $targetContent)
|
||||
{
|
||||
Write-Host "Stopping the Splunk forwarder"
|
||||
Stop-Service splunkforwarder
|
||||
try {
|
||||
Stop-Service splunkforwarder -ErrorAction Stop
|
||||
} catch {
|
||||
Write-Host "Failed to stop SplunkForwarder. Trying again..."
|
||||
Set-Location "C:\Program Files\SplunkUniversalForwarder\bin"
|
||||
& ".\splunk.exe" "stop"
|
||||
}
|
||||
|
||||
Write-Host "Deleting the default configuration"
|
||||
Remove-Item $inputsPath
|
||||
|
||||
Reference in New Issue
Block a user