支持所有PS版本
如果你找出某台频繁进入睡眠模式的电脑,这里有一个函数脚本能获取适当的事件日志从其中得到一张详细列表,报告电脑什么时候进入睡眠模式和睡眠的多久:
function Get-HibernationTime { # get hibernation events Get-EventLog -LogName system -InstanceId 1 -Source Microsoft-Windows-Power-TroubleShooter | ForEach-Object { # create new object for results $result = 'dummy' | Select-Object -Property ComputerName, SleepTime, WakeTime, Duration # store details in new object, convert datatype where appropriate [DateTime]$result.Sleeptime = $_.ReplacementStrings[0] [DateTime]$result.WakeTime = $_.ReplacementStrings[1] $time = $result.WakeTime - $result.SleepTime $result.Duration = ([int]($time.TotalHours * 100))/100 $result.ComputerName = $_.MachineName # return result $result } }
原文地址:Get Sleep and Hibernation Times
本文链接: https://www.pstips.net/get-sleep-and-hibernation-times.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!