⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 win32_ntlogevent.asp

📁 集合了学习asp的100个实例
💻 ASP
字号:
<html>

<head>

<title>事件查看器</title>

</head>

<body>

<% 

  Dim objLocator, objService, objWEBMCol, objWEBM, vType

  Set objLocator = CreateObject("WbemScripting.SWbemLocator") 

 

  'Establish a connection to WMI



   Set objService = objLocator.ConnectServer



 

  'Get the Webm Service object

  Set objWEBMCol = objService.ExecQuery("SELECT * FROM " & _

 " win32_NTLogEvent WHERE LogFile='system'")

 

  Response.write "<H2><center>事件查看器</center></H2><HR><UL>"

  'Enumerate 

%>

<table border=1 width=120%>

<tr>

  <td width=10%>计算机</td><td width=8%>来源</td><td width=8%>事件</td><td width=10%>类型</td><td>消息描述</td><td width=20%>用户</td>

</tr>

<%

  For Each objWEBM in objWEBMCol

 

 vType = ""

 if objWEBM.Type = "error"  then

    vType = "错误" 

 elseif objWEBM.Type = "warning"  then

    vType = "警告" 

 elseif objWEBM.Type = "information"  then

    vType = "信息" 

 else

    vType=objWEBM.Type

 end if

 

   Response.write "<tr><td>" & objWEBM.ComputerName & _

    "</td><td>" & objWEBM.SourceName & _

    "</td><td>" & objWEBM.EventCode & _

    "</td><td>" & vType & _

    "</td><td>" & left(objWEBM.Message,15) & _

    "……</td><td>" & objWEBM.User

  Next

  response.write "</td></tr></table>"

  Set objLocator = Nothing

  Set objService = Nothing

  Set objWEBMCol = Nothing

  Set objWEBM = Nothing



%>

</body>

</html>

 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -