Skip to content

Instantly share code, notes, and snippets.

@halr9000
Created June 27, 2014 14:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save halr9000/a457fd519909a85c0027 to your computer and use it in GitHub Desktop.
Save halr9000/a457fd519909a85c0027 to your computer and use it in GitHub Desktop.
PowerShell function to start Splunk
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