Advertisement
Moktart

Splunk Monitor

Jan 6th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. $SplunkUrl = "https://splunkserver"
  2. $LoginPage = invoke-webrequest -Uri $SplunkUrl -SessionVariable session
  3. $LoginPage.forms[0].Fields.username = "test"
  4. $LoginPage.forms[0].Fields.password = "test"
  5. $SubmitAction = $LoginPage.Forms[0].Action
  6. try {Invoke-WebRequest -Uri "$SplunkUrl$SubmitAction" -Method Post -Body $LoginPage.forms[0].fields -WebSession $Session}
  7. catch {if ($error[0].ErrorDetails.Message -match "500 Internal Server Error") {restart-service splunkd}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement