Is there a way to run a report on shutdown and restart on a particular pc?

2 Comments   [ + ] Show Comments

Comments

  • Are you wanting to know when the last time it shutdown, or every time it has shutdown?
  • everytime... thank you
Please log in to comment

Answers

1

Since Kace doesn't get every restart by default you might want to try a custom inventory rule. After the machine has checked in you can then turn it into a report.

ShellCommandTextReturn(powershell.exe "get-eventlog system|WHERE-OBJECT{$_.EventID -eq 1074}|sort-object timewritten|format-list timewritten,message")
Answered 06/28/2013 by: dugullett
Red Belt

  • this would work perfect.. thank you very much!!
    It is working on 2003 server, w7 and 2012 server not on windows 2008 r2 servers any idea why it is ?
    • I would check to make sure you can run that powershell command locally on server 08. I don't have one off hand to test on. Make sure the event ID 1074 is the same on 08.
  • not sure why its not running... i can run it manually on the server and it works; i was able to get the output to a text file

    get-eventlog system|WHERE-OBJECT{$_.EventID -eq 1074}|sort-object timewritten|format-list timewritten,message >>c:\restartlog.txt
    • You can create a custom inventory to read that .txt file. Would it be possible for you to set up a scheduled task to run on your servers? Either that or from a KScript?

      ShellCommandTextReturn(cmd.exe /c type C:\restartlog.txt)

      You might even be able to use your current one that works on other OSs, and use an OR (not tested).

      ShellCommandTextReturn(powershell.exe "get-eventlog system|WHERE-OBJECT{$_.EventID -eq 1074}|sort-object timewritten|format-list timewritten,message") OR ShellCommandTextReturn(cmd.exe /c type C:\restartlog.txt)
Please log in to comment
Answer this question or Comment on this question for clarity