0

I try to automatically log the startup and shutdown times of my Windows Client (Windows 7 and newer) to a log file for later analysis.

Therefore I created a task in Task Scheduler which executes the following statement.

echo %date% %time% >>"C:\Temp\time_logging.log"

The triggers are "on system startup" and "on event" (for shutdown). As event I have chosen option "minimal/basic", source "eventlog" and event id "6006".

The startup is logged, but the shutdown isn't logged. The task is executed with "local service", the permission on the log file and folder is "local service" is "modify" (read, write, modify).

Do you have any clue what I'm doing wrong? Perhaps I choose an event, when the system has no more possibilities to write to file? But what event can I use for this scenario?

1
  • The Event Log "System" already contains all necessary information (events 12, 13 of Kernel-General). Accessing it isn’t that easy though.
    – Daniel B
    Commented Apr 7, 2017 at 12:21

1 Answer 1

0

The scheduled task is the right way to do it. For shutdown however, run gpedit.msc (Local Group/User Policies) and then go to Windows settings -> Scripts -> Shutdown -> Properties -> Add and set up a shutdown script.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .