WMI 和 计算机电源设置 - 上次退出待机状态的日期/时间
我试图找出计算机上次退出待机/休眠状态的时间。 我知道我可以通过观看 Win32_PowerManagementEvent 来得到这个,但这在这种情况下不起作用,因为我需要一些可以轮询的东西 - 有什么想法吗? 它不一定是 WMI,我只是假设它就在这个地方。
谢谢!
I'm trying to find out the last time a computer came out of standby/hibernate. I know I could get this by watching Win32_PowerManagementEvent, but that doesn't work in this instance as I need something I can poll - any ideas? It doesn't have to be WMI, I'm just assuming that's the place it would be.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实上,就像通常发生的那样,我一发布就明白了这一点。
因此,为了监视计算机何时退出待机状态,即 Win32_PowerManagementEvent 中的 EventType 7,我使用了 Powershell。
然后我进入并退出待机状态,并执行 Get-PSEvent,这显示了我创建的事件。 我本来可以使用 -action 来分配一个脚本块在该事件发生时运行,但我正在寻找要轮询的内容。
Actually, as it usually happens, I figured this out as soon as I posted it.
So, to watch for when a computer comes out of standby, which is EventType 7 in Win32_PowerManagementEvent I used Powershell.
Then I went into and came back out of standby, and did Get-PSEvent, which showed my event I created. I could have just used -action to assign a scriptblock to run when that event occurs, but I was looking for something to poll.
太棒了,感谢您提供这个解决方案! 我设法使用您的脚本作为模板来运行我的脚本。 我可以使用任务计划程序运行它。
Awesome, thank you for this solution! I managed to get my script working using yours as a template. I can just run this using Task Scheduler.