Joh*_*hnC 100 windows-server-2008 windows-event-log windows-server-2008-r2 windows-server-2012 windows-server-2012-r2
如何轻松查看每次 Windows Server 重新启动或关闭的历史记录以及原因,包括用户启动、系统启动和系统崩溃?
Windows 事件日志是一个显而易见的答案,但我应该查看的完整事件列表是什么?
我发现这些帖子部分回答了我的问题:
但那些并没有涵盖所有场景 AFAIK 并且信息很难理解,因为它分布在多个答案中。
我有多个版本的 Windows Server,因此一个至少适用于 2008、2008 R2、2012 和 2012 R2 版本的解决方案将是理想的。
Joh*_*hnC 120
我能找到的最清晰最简洁的答案是:
其中列出了要监控的这些事件 ID(引用但已从文章中编辑和重新格式化):
从我的 OP 中列出的服务器故障答案中添加更多内容:
我错过了吗?
ocr*_*tte 13
将@user10082评论变成答案。建议的解决方案是单行的,如 Powershell 脚本:
Get-EventLog -LogName System |? {$_.EventID -in (6005,6006,6008,6009,1074,1076)} | ft TimeGenerated,EventId,Message -AutoSize –wrap
Run Code Online (Sandbox Code Playgroud)
这是输出:
TimeGenerated EventID Message
------------- ------- -------
5/30/2021 11:23:16 AM 6005 The Event log service was started.
5/30/2021 11:23:16 AM 6009 Microsoft (R) Windows (R) 10.00. 19042 Multiprocessor Free.
5/30/2021 11:23:16 AM 6008 The previous system shutdown at 18:35:45 on ?24/?05/?2021 was unexpected.
5/24/2021 11:55:45 AM 6005 The Event log service was started.
5/24/2021 11:55:45 AM 6009 Microsoft (R) Windows (R) 10.00. 19042 Multiprocessor Free.
5/24/2021 11:55:31 AM 6006 The Event log service was stopped.
5/24/2021 11:55:27 AM 1074 The process C:\Windows\system32\SystemSettingsAdminFlows.exe (DESKTOP) has
initiated the restart of computer DESKTOP on behalf of user DESKTOP\User
for the following reason: Other (Unplanned)
Reason Code: 0x0
Shutdown Type: restart
Comment:
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
556010 次 |
| 最近记录: |