#pragma namespace ("\\\\.\\Root\\subscription") instance of ActiveScriptEventConsumer as $CONSUMER { Name = "ExternalScriptConsumer"; ScriptingEngine = "VBScript"; ScriptFileName = "C:\\Consumer.vbs"; }; instance of __EventFilter as $FILTER { EventNamespace = "\\\\.\\Root\\Cimv2"; Name = "MyRemDevFilter2"; Query = "Select * From __InstanceDeletionEvent Within 2" "Where TargetInstance Isa \"Win32_Process\" " "And Targetinstance.Name = \"notepad.exe\" "; QueryLanguage = "WQL"; }; instance of __FilterToConsumerBinding { Consumer = $CONSUMER; Filter = $FILTER; };
strComputer = "." strService = " 'Alerter' " Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colListOfServices = objWMIService.ExecQuery _ ("Select * from Win32_Service Where Name ="_ & strService & " ") For Each objService in colListOfServices objService.StartService() Next
instance of ActiveScriptEventConsumer as $Consumer { Name = "TestConsumer2"; ScriptingEngine = "VBScript"; ScriptText = "Set objFSO = CreateObject(\"Scripting.FileSystemObject\")\n" "Set objFile = objFSO.OpenTextFile(\"c:\\log.txt\", 8, True)\n" "objFile.WriteLine Time & \" \" & \" Notepad started stoped\"\n" "objFile.Close\n"; };
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)