How to terminate all instances of internet explore using collections
'Code to close all Internet explorer browser process using QTP
Dim ObjWMIService, IExplore,IItem
Dim strComputer
strcomputer="."
'Get the WMI object
Set ObjWMIService=GetObject("Winmgmts:\\"& strcomputer & "\root\cimv2")
'Get collection of processes for with name iexplore.exe
set IExplore=ObjWMIService.execquery("Select * from win32_process where name='iexplore.exe'")
'Loop through each process and terminate it
For each IItem in IExplore
IItem.terminate
Next
Set IExplore= Nothing
Set ObjWMIService= Nothing
'Code to close all Internet explorer browser process using QTP
Dim ObjWMIService, IExplore,IItem
Dim strComputer
strcomputer="."
'Get the WMI object
Set ObjWMIService=GetObject("Winmgmts:\\"& strcomputer & "\root\cimv2")
'Get collection of processes for with name iexplore.exe
set IExplore=ObjWMIService.execquery("Select * from win32_process where name='iexplore.exe'")
'Loop through each process and terminate it
For each IItem in IExplore
IItem.terminate
Next
Set IExplore= Nothing
Set ObjWMIService= Nothing
No comments:
Post a Comment