title: Is there a way to shut a Windows Service Down or perform an action when the PC is shutdown with Fast Startup enabled
body: <p>I have a Windows Service running on Windows 10 that is required to do something to some external Hardware when the PC is shutdown.</p>
  
  <p>I have this working on a PC when a true Shutdown occurs but I've recently discovered some PC's ( possible by default now ) have Windows Fast Start Enabled.</p>
  
  <p><a href="https://i.stack.imgur.com/e8jDI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e8jDI.png" alt="Fast Startup Option Enabled"></a></p>
  
  <p>In this case OnShutDown() is not called in the service and I can't shutdown the HW correctly. I've implemented the Pre-shutdown technique <a href="https://www.atomia.com/2011/11/16/how-to-process-the-preshutdown-event-in-a-managed-windows-service/" rel="nofollow noreferrer">here</a> but it also isn't called. ( kind of obvious I guess ).</p>
  
  <p>So my question is "Is there a way to do something that would run code in my Service when a Shut-Down with Fast Restart is enabled or is my only route mandating to all users that Fast Startup be disabled?"</p>
  
  <p>Any help here or clarity on my options would be greatly appreciated.</p>
  
  <p>I'm using Windows 10, .NET 4.6.1, C#, WCF hosted in Windows Service, x86.</p>