Windows Task scheduler Winlogon events - logout not enough(?)

5

I created a powershell script that I want to run on every logout / restart / shut down.

For trigger I set a custom event: Log: System, Source: Winlogon, Event ID: 7002. I found the above event id somewhere on the internet - it stands for log out (AFAIK).

The problem is that it works only when I go and press Log Out. It doesn't when I want to Shut down or Restart the PC.

Should it even work? And if not, where can I find the other event ID's? How do I even look for them? (I mean what is their name?)

Martin Fejes

Posted 2014-02-13T16:09:15.713

Reputation: 262

What is the script supposed to do? – and31415 – 2014-02-13T16:29:01.143

It deletes files. – Martin Fejes – 2014-02-13T18:24:21.233

Answers

5

You should add event IDs:

These reflect a variety of log on/off scenarios and shutdowns.

Reference:

Qwilson

Posted 2014-02-13T16:09:15.713

Reputation: 626

http://support.microsoft.com/kb/293814 and http://technet.microsoft.com/en-us/library/dd941621(v=ws.10).aspx ... I'm editing my post to reflect this information. – Qwilson – 2014-02-13T21:55:54.023

I see. So simply the logout event was not enough. Can you please tell me where I can find a list of these events and their ID's? – Martin Fejes – 2014-02-13T21:57:25.347

1

Unfortunately, I don't know of a definitive list of of all the related on/off id's, but if you search http://www.eventid.net/ you will find a wealth of information regarding all kinds of events.

– Qwilson – 2014-02-13T22:03:46.433

2

Instead of telling you what events I guess might happen, here is how to discover the events yourself:

You can check the events that have happened on your device by checking your Event Viewer through Control Panel. It will show you their names and event ID numbers.

The logon/logoff events show up under the folder called "Windows Events" on the log called "Security".

If there are any events you are not catching, you will now be able to know what they are!

Kevin Panko

Posted 2014-02-13T16:09:15.713

Reputation: 6 339