Quantcast
Channel: VMware Communities : Popular Discussions - VMware ThinApp: Discussion Forum
Viewing all articles
Browse latest Browse all 57744

Script to kill process in task manager

$
0
0

Hello,

 

I have a problem with a application that I have thinapped, when the user exits the program it remains running in task manager.

 

Then when the user tries to re-launch the program at a later time they recieve an error message that it is already running.

 

I am trying to create a kill.vbs script that will terminate the process after the user closes the program but I am having some difficulties getting results.

 

I have tried some different examples and functions found on the web and on here but the processes still seem to stay running.

 

Is there a way to determine if the script is executing correctly ?

 

I have been using the below script within different functions (OnFirstParentExit etc... )

 

Am I correct in placing this code in a 'kill.vbs' file and saving it to the root folder ?

 

Any suggestions would be much appreciated.

 

 

-


 

Function OnFirstParentExit

 

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate{color:#ff0000}}!\{color}" & strComputer & "\root\cimv2")

Set colProcessList = objWMIService.ExecQuery _

("SELECT * FROM Win32_Process WHERE Name = 'xcal.exe'")

For Each objProcess in colProcessList

objProcess.Terminate()

Next

 

End Function

 

-


 


Viewing all articles
Browse latest Browse all 57744

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>