Starting with Windows 7 (possibly Vista), when you start the Microsoft-Windows-Power-Troubleshooter computer, you can enter the system event log by specifying the source of the wake-up. Here are two events (taken on the Windows 8 desktop, but I have the same on my Window 7 laptop), the first was generated by WOL, the second was generated using the button on the front panel:


So, using PowerShell, you can test:
(Get-EventLog -LogName System -Source "Microsoft-Windows-Power-Troubleshooter" -AsBaseObject | Sort-Object {$_.timegenerated} | select -last 1 ).Message
So you need to parse the message (not very good)
get-winevent -FilterHashtable @{"ProviderName"="Microsoft-Windows-Power-Troubleshooter";"id"=1} | Sort-Object {$_.timecreated} | select -last 1 | %{([xml]$_.ToXml()).Event.EventData.Data}
Note. The Microsoft-Windows-Power-Troubleshooter provider also exists on W2K8-R2, when I try to run Wake On Lan on one of my old servers, WakeSourceType unknown.
JPBlanc
source share