-
-
Save bshuler/b4279f200f6b98133ef2d5150d711936 to your computer and use it in GitHub Desktop.
PowerShell function to start Splunk
This file contains 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
Function Start-Splunk { | |
try { | |
Get-Service splunk* | Start-Service -ErrorAction Stop | |
} | |
catch [Microsoft.PowerShell.Commands.ServiceCommandException] { | |
Write-Verbose "Command must be run in an elevated session, invoking new session." | |
Start-Process -Verb Runas -FilePath powershell.exe { Get-Service splunk* | Start-Service -Verbose -ErrorAction Stop; Start-Sleep 5 } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment