Check `Restore on AC/Power Loss` from CMD/Powershell on windows 10
Found WakeUpType
property of the Win32_ComputerSystem
class
WakeUpType
Data type:
uint16
Access type:Read-only
Qualifiers: MappingStrings ("SMBIOS|Type 1|System Information|Wake-up Type
")Event that causes the system to power up.
This value comes from the Wake-up Type member of the System Information structure in the SMBIOS information.
- Reserved (0) - Other (1) - Unknown (2) - APM Timer (3) - Modem Ring (4) - LAN Remote (5) - Power Switch (6) - PCI PME# (7) - AC Power Restored (8)
Read System Management BIOS (SMBIOS) Reference Specification as well.
Next script requires following adjustments to satisfy (your) particular operational circumstances:
-
$computers
array (e.g. read it from a file); -
$WakeUpType = Get-WmiObject
(e.g. add-Authentication
or-Credential
etc. parameters, seeGet-Help 'Get-WmiObject' -ShowWindow
).
$WakeUpTypes = DATA {ConvertFrom-StringData -StringData @’
0 = Reserved (0)
1 = Other (1)
2 = Unknown (2)
3 = APM Timer (3)
4 = Modem Ring (4)
5 = LAN Remote (5)
6 = Power Switch (6)
7 = PCI PME# (7)
8 = AC Power Restored (8)
na = ? unreachable ? (N/A)
‘@}
$computers = ".", "$env:COMPUTERNAME", ### I *know* that these are the same
"bububu" ### and this is fake name for debugging
$namespace = "ROOT\CIMV2"
$classname = "Win32_ComputerSystem"
ForEach ( $computer in $computers ) {
Try {
$WakeUpType = Get-WmiObject `
-Class $classname -ComputerName $computer -Namespace $namespace `
-ErrorAction SilentlyContinue
$WakeUpName = $WakeUpTypes.Item("$($WakeUpType.WakeUpType)")
} Catch {
$WakeUpName = $WakeUpTypes.Item("na")
}
If ( $WakeUpName -eq $null ) { $WakeUpName = "Undefined as yet ($WakeUpType)" }
"{0,-20} {1}" -f $computer, $WakeUpName
}
Run in PowerShell
Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -Property e,WakeUpType