I want my C# Service to perform some tasks before a Windows shutdown. I see that there is an event SystemEvents.SessionEnding Event. However it does not seem to distinguish between a logoff and a system shutdown. Anyone know of a way of detecting a shutdown? Thanks.
This is not a duplicate of the following question since I am specifically referencing Shutdown not Shutdown|Logoff: How to detect Windows shutdown or logoff