Apr 30
Monitoring New Processes
It is amaizing how often new processes are launched on your computer, all of them doing their own thing and a lot of times you have no idea they are doing it. This can be a dangerious thing if your friends have been learning about office warfare and are startring to install things on your computer. However it does us little good to just watch the task manager since there are a lot of processes that start when your computer starts up and it can be hard to sort it all out.
However monitoring new processes can be quite useful since that will show you what new things are cropping up all the time. Fortunately for all of us there is a great scripting language that comes pre built into windows machines called Windows Management Instrumentation (WMI) that when coupled with the Visual Basic Scripting language (vbs) will allow us to monitor new processes.
Lets look at the code after the break.
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colMonitorProcess = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceCreationEvent " _
& " WITHIN 1 WHERE TargetInstance ISA 'Win32_Process'")
WScript.Echo "Process Watcher Started"
i = 0
do while (i<10)
Set objLatestEvent = colMonitorProcess.NextEvent
Wscript.Echo "Process Name: " & objLatestEvent.TargetInstance.Name
i = i+1
loop
Basically this code creates a winmgmts object for the local comptuer (.) and does a ExecNotificationQuery that asks to be notified of the creation of any win32_process classes. Then int lets us know that the process has been created with a message box. The script closes after it has detected 10 new processes otherwise you would have to kill wscript.exe in the task manager to end it. If you want it to loop continuously jsut change
do while (i<10)
to
do while (1)
[...] can be hard to sort it all out. However monitoring new processes can be quite useful since … MORE >>Creadit By weight [...]