Skip to content

Instantly share code, notes, and snippets.

@bshuler
Forked from halr9000/splunkutils.ps1
Created September 14, 2016 13:24
Show Gist options
  • Save bshuler/b4279f200f6b98133ef2d5150d711936 to your computer and use it in GitHub Desktop.
Save bshuler/b4279f200f6b98133ef2d5150d711936 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