System Shutdown / Restart Report for a particular machine - K1000
Is there a way to run a report on shutdown and restart on a particular pc?
2 Comments
[ + ] Show comments
-
Are you wanting to know when the last time it shutdown, or every time it has shutdown? - dugullett 11 years ago
-
everytime... thank you - binuani 11 years ago
Answers (1)
Please log in to answer
Posted by:
dugullett
11 years ago
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")
Comments:
-
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 ? - binuani 11 years ago-
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. - dugullett 11 years ago
-
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 - binuani 11 years ago-
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) - dugullett 11 years ago