I'm trying to set up a task that should only run when Windows starts from a completely powered-off state, but if it's just a restart, I want to skip it. I've looked into possible methods, but most suggestions involve checking timestamps in the Event Log, which hasn't yielded clear results. I'm wondering if there are any recent updates in Windows or PowerShell that could help differentiate between a cold boot and a warm reboot.
1 Answer
You can easily use the Event Log to differentiate between cold and warm boots. The log generates different event IDs based on the boot type, so you could write a simple script to scan through it and respond accordingly.

I checked the Event Log, and I only saw event ID 6009 for both types. Are there other IDs I'm missing?