Windows
從 Windows 10 上的 CMD/Powershell 檢查“在 AC/Power Loss 上恢復”
我已經為一些 Windows 機器設置了電腦啟動時從 windows Bios 菜單中的 AC/Power Loss 恢復。
有人如何(遠端)確認我已經做到了,有沒有辦法從遠端桌面做到這一點?
如果您知道如何遠端更改它(如果可以的話),則可以加分。
我做了什麼:
找到類
WakeUpType
的屬性Win32_ComputerSystem
喚醒類型
數據類型:
uint16
訪問類型:Read-only
限定符:MappingStrings ("SMBIOS|Type 1|System Information|Wake-up Type
")導致系統啟動的事件。
該值來自SMBIOS資訊中**System Information結構的Wake-up Type成員。
- 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)
下一個腳本需要進行以下調整以滿足(您的)特定操作環境:
$computers
數組(例如從文件中讀取);$WakeUpType = Get-WmiObject
(例如添加-Authentication
或-Credential
等參數,請參閱Get-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 }