04-13-2011, 04:24 PM
Above code is only to close one notepad. If their are more than one notepad to be closed then try with this code:
Regards,
Seema Gupta
Code:
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = notepad
“)
For Each objProcess in colProcess
objProcess.Terminate()
Next
Seema Gupta