SHARE
TWEET

Untitled

a guest Nov 13th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $csv = import-csv c:\status.csv
  2.  
  3. # Internal variables, change underway to set exit status
  4. $statuswarning = $False
  5. $statuscritical = $False
  6.  
  7. # Parse data and evaluate status
  8. if($csv.RegistrationState -like "Registered"){
  9.    $registered = 1
  10. }elseif($csv.RegistrationState -like "Unregistered"){
  11.   $registered = 0
  12.   $statuscritical = $True
  13. }else{
  14.   $registered = -1
  15.   $statuscritical = $True
  16. }
  17. if($csv.InMaintenanceMode -like $True){
  18.   $maintenance = 1
  19.   $statuswarning = $True
  20. }else{
  21.   $maintenance = 0
  22. }
  23. if($csv.Faultstate -like "None"){
  24.  $faultstate = 0
  25. }else{
  26.  $faultstate = 1
  27.  $faultstatemessage = "Serverfeil"
  28.  $statuswarning = $true
  29. }
  30. if($csv.WindowsConnectionSetting -like "LogonEnabled"){
  31.   $windowsconnection = 1
  32. }else{
  33.   $windowsconnection = 0
  34.   $windowsconnectionmessage = "Logon deaktivert: $($csv.WindowsConnectionSetting)"
  35.   $statuswarning = $True
  36. }
  37.  
  38.  
  39.  
  40. # Return integer (numeral) status
  41. write-host "Message.RegistrationState:" "Registreringsstatus i farm"
  42. write-host "Message.InMaintenanceMode:" "1 = Maintenance Aktivert, 0 = Ikke Aktivert"
  43. write-host "Message.WindowsConnectionSetting:" "1 = Pålogging tillatt, 0 = Pålogging stengt"
  44. write-host "Message.FaultState:" "Serverens feiltilstand"
  45. write-host "Message.LoadIndex:" "Nåværende loadindex for serveren"
  46. write-host "Message.SessionsEstablished:" "Tilkoblede brukere"
  47. write-host "Statistic.RegistrationState:" $registered
  48. write-host "Statistic.WindowsConnectionSetting:" $windowsconnection
  49. write-host "Statistic.FaultState": $faultstate
  50. write-host "Statistic.LoadIndex:" $csv.loadindex
  51. write-host "Statistic.SessionsEstablished": $csv.SessionsEstablished
  52. write-host "Statistic.InMaintenanceMode:" $maintenance
  53.  
  54. # Return status based on statuswarning/statuscritical variables
  55. if($statuscritical){
  56.   exit(3)
  57. }elseif($statuswarning){
  58.   exit(2)
  59. }else{
  60.   exit(0)
  61. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top