strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colIEProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'iexplore.exe'")
For Each objProcess in colIEProcessList
objProcess.Terminate()
Next
End Function
hi
ReplyDeleteWhy is that much procedure needed to close all the opened IE browsers
ReplyDeleteUse simply -
SystemUtil.CloseByProcessName "iexplore.exe"
that's it..
You r Correct Sreenu.
ReplyDeleteBut if you want to write your own method to close this is the way.
I use • Close all IE browsers: SystemUtil.CloseProcessByName("iexplore.exe")
ReplyDeleteBoth are different.
ReplyDeleteSystemUtil.CloseProcessByName("iexplore.exe")
It will throw a validation error if no instances are open in the above case.
But if the mentioned function is used. it will close all/any open instances .