top of page

System loglarından sunucunun UP/Down durumunu görebilmek

  • Yazarın fotoğrafı: Enis GOKTAY
    Enis GOKTAY
  • 25 Mar 2014
  • 1 dakikada okunur

Aşağıdaki script sayesinde eventlardan sunucunun durumunu görebiliriz.

Function Get-UpTime { param ( $SunucuAdi=’localhost’ ) Get-WmiObject Win32_NTLogEvent –Filter ‘Logfile=”System” and EventCode>6004 and EventCode<6009’ –ComputerName $SunucuAdi | ForEach-Object { $lgnm =$_ | Select-Object EventCode, TimeGenerated switch ($_.EventCode) { 6006 {$lgnm.EventCode= ‘shutdown’ } 6005 {$lgnm.EventCode = ‘start’ } 6008 {$lgnm.EventCode= ‘crash’ } 6009 {$lgnm.EventCode= ‘Unexpected Shutdown’ } } $rv.TimeGenerated =$_.ConvertToDateTime($_.TimeGenerated) $rv } }

Son Yazılar

Hepsini Gör

Comentários


Abonelik Formu

Gönderdiğiniz için teşekkür ederiz!

bottom of page