How to know by which method did my system boot?

0

Is there any way of detecting as to whether my system started by manually pressing the power button or did it start because of a Wake-On-LAN packet??Can i store this value somewhere and use it programmatically??

Nishant Dwivedi

Posted 2015-07-14T09:35:20.413

Reputation: 11

I expect this to be BIOS feature, since it doesn't exist, no – OverCoder – 2015-07-14T10:15:04.583

can i have any more suggestions as to how to achieve this information??? – Nishant Dwivedi – 2015-07-15T06:47:26.757

Answers

0

In Windows, the wake source is logged in the System Log. I'm not sure if it specifically logs your WOL-packet as a source, but you'd have to try for yourself as there are different systems in place which why the method described below is not fail-proof. (I hope all the English terms are correctly translated as I am using a Dutch copy of Windows. Therefore, if you can't find something, look for anything remotely similar! ;-))


The manual, human way:

  1. Find the System Log by opening up the run dialog by pressing Win + r. Enter eventvwr.msc and then run.
  2. On the left, open up Windows Logs and then System.
  3. Right-click System and select Filter Current Log...
  4. In the dialog that pops up, under Event Sources, select Power-Troubleshooter and click OK.

It should now list all power-related log entries. If you click one, the General tab should also list the Wake source.


Example through PowerShell:

System logs can be accessed through PowerShell. The below command on PowerShell will return the last log entry about power containing the "Wake Source". Adapt it to your needs. (Regex that stuff!)

Get-EventLog "System" | Where-Object {$_.source -like "*Microsoft-Windows-Power-Troubleshooter*"} | select -first 1 | Format-List 

BloodPhilia

Posted 2015-07-14T09:35:20.413

Reputation: 27 374

in the general tab the wake source is being displayed as unknown – Nishant Dwivedi – 2015-07-14T10:23:39.167

@NishantDwivedi That can on itself be used as a source, since there won't be many unknown sources. Unless you're using very niche ways of powering on your system, of course... It's not fail-proof... But then again, I don't know what you need it for. – BloodPhilia – 2015-07-14T10:26:16.587

I tried this a few times today and the results are very hit and miss... I put my computer to sleep a number of times and woke it up using the power button, mouse, keyboard and WOL... none of which were entered in the Event Viewer (and subsequently filtered using above)... coincidentally, the only place that did show a result was cmd powercfg -lastwake but this only showed the WOL (my network adapter) - which was my first test... – Kinnectus – 2015-07-14T10:29:35.490

@BigChris odd... My log shows if it's an HID or power button all the time. Could this be related to differences between mainboards? – BloodPhilia – 2015-07-14T10:34:31.563

@BigChris powercfg -lastwake as far as i know only gives the count if my system woke up from sleep or from a hibernate state i even want the state if my system wakes from shutdown. – Nishant Dwivedi – 2015-07-14T10:35:51.150

@BigChris may be it is because of the motherboard...moreover i just started my system from hibernate but powercfg -lastwake if showing only the wakecount as 1 and no further info – Nishant Dwivedi – 2015-07-14T10:37:17.663

1Probably is motherboard related because I just tried it again and the only entries in Event Viewer are the system going TO sleep... nothing about being woken up... it may be worth the answerer noting that different hardware may not make this solution 100% reliable... – Kinnectus – 2015-07-14T10:44:24.023

Then I guess my mentioning about BIOS waa correct, right? – OverCoder – 2015-07-14T11:06:26.057

ya @Yousef's even u wrote 'no' as if u were sure that if u dont know of this then it wont exist – Nishant Dwivedi – 2015-07-14T13:47:56.380

anyways lets not argue i just want the info as i require to do some work by using this info – Nishant Dwivedi – 2015-07-14T13:51:16.700