QTP Forum
Shopmotion


How to kill Application process or multiple processes using VBscript Empty
Search
 
 

Display results as :
 


Rechercher Advanced Search

Poll
Keywords

Latest topics
September 2019
MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
30      

Calendar Calendar

Affiliates
free forum


How to kill Application process or multiple processes using VBscript

Go down

Vote if this topic was useful to you

How to kill Application process or multiple processes using VBscript Vote_lcap0%How to kill Application process or multiple processes using VBscript Vote_rcap 0% 
[ 0 ]
How to kill Application process or multiple processes using VBscript Vote_lcap0%How to kill Application process or multiple processes using VBscript Vote_rcap 0% 
[ 0 ]
How to kill Application process or multiple processes using VBscript Vote_lcap100%How to kill Application process or multiple processes using VBscript Vote_rcap 100% 
[ 1 ]
How to kill Application process or multiple processes using VBscript Vote_lcap0%How to kill Application process or multiple processes using VBscript Vote_rcap 0% 
[ 0 ]
 
Total Votes : 1

How to kill Application process or multiple processes using VBscript Empty How to kill Application process or multiple processes using VBscript

Post by Gajre on Wed Jul 04, 2012 3:42 am

''The below code can be used to kill a process/ processes, running in the Windows Task Manager.

strProcessNames = "EXCEL.exe|chrome.exe|notepad.exe"
Call KillProcesses(strProcessNames)

Function KillProcesses(strProcessNames)
''Get Current User Logged In
Set objNetwork1 = CreateObject("Wscript.Network")
currUser1 = objNetwork1.UserName
''Kill Process(es) based on *.exe and current user
strComputer = "."
Set objWMIService1 = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2")
''Split the Processes by the delimiter and loop them
KillProcess1 = Split(strProcessNames,"|")
For x = 0 to Ubound(KillProcess1)
Set colProcessList1 = objWMIService1.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name ='"& KillProcess1(x) &"'")
For Each objProcess1 in colProcessList1
If objProcess1.GetOwner ( User, Domain ) = 0 Then
If UCase(User) = UCase(currUser1) then
objProcess1.Terminate()
end if
end if
Next
Next
End Function
Gajre
Gajre
Admin

Posts : 37
Join date : 2012-06-17
Age : 36
Location : Hyderabad

View user profile https://qtpelearning.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum