newproc.wsf

来自「Apress - Managing Enterprise Systems Wit」· WSF 代码 · 共 27 行

WSF
27
字号
<?xml version="1.0" ?>
<job>
<!--comment
Script:newproc.wsf
Description:monitors the creation of new processes
-->
 <script language="VBScript" src="wmiinc.vbs">
 <![CDATA[
  Dim objService, objEvent, objEvents

  Set objService = GetObject("winmgmts:{impersonationLevel=impersonate}")
  'check for the creation of any new programs/processes every 60 seconds
  Set objEvents = objService.ExecNotificationQuery _ 
      ("select * from __instancecreationevent within 60 " & _ 
        "where targetinstance isa 'Win32_Process'") 

 ' Note this next call will wait indefinitely - a timeout can be specified 
  WScript.Echo "Waiting for process creation..."
  Do 
   Set objEvent = objEvents.Nextevent 
   WScript.Echo objEvent.TargetInstance.ExecutablePath & " started at " & _
                DMTFDate2String(objEvent.TargetInstance.CreationDate)
  Loop
  ]]>
 </script>
</job>

⌨️ 快捷键说明

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