Goblin_M 2021-12-07 15:11 采纳率: 100%
浏览 18
已结题

powershell监控日志信息,异常,给指定电脑发送消息

我是一名运维,服务器上运行这一个软件,但时不时会出现内存不能写导致软件停止运行,有需求监控日志,系统--信息类,ID事件为26,看了原创文章
https://blog.csdn.net/chenshanliang/article/details/116453506

$query = "SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_NTLogEvent' and TargetInstance.Logfile = 'Application' and TargetInstance.Type='错误' and TargetInstance.SourceName='MSSQLSERVER'"
 
#Register WMI event
Register-WMIEvent -Query $query -Action { 
$d=$eventArgs.NewEvent.TargetInstance.Message 
$Message='Server: '+$d
 msg /server:你接收的IP * $Message
 
}

有启发,但是我想要根据系统日志里的系统--信息类,ID事件为26,为监控对象,请问各位大佬怎么改

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 12月15日
    • 修改了问题 12月7日
    • 创建了问题 12月7日