title: How to "End Task" not "Kill" or "Terminate"?
body: <p>I have a 3G card to provide internet to a remote computer... I have to run a program(provided with the card) to establish the connection... since connections suddenly is lost I wrote a script that Kills the program and reopens it so that the connection is reestablished, there are certain versions of this program that don't kill the connection when killed/terminated, just when closed properly.</p>
  
  <p>so I am looking for a script or program that "Properly Closes" a window so I can close it and reopen it in case the connection is lost.</p>
  
  <p>this is the code that kills the program</p>
  
  <pre><code>Option Explicit
  Dim objWMIService, objProcess, colProcess
  Dim strComputer, strProcessKill 
  strComputer = "."
  strProcessKill = "'Telcel3G.exe'" 
  
  Set objWMIService = GetObject("winmgmts:" _
  &amp; "{impersonationLevel=impersonate}!\\" _ 
  &amp; strComputer &amp; "\root\cimv2") 
  
  Set colProcess = objWMIService.ExecQuery _
  ("Select * from Win32_Process Where Name = " &amp; strProcessKill )
  For Each objProcess in colProcess
  objProcess.Terminate()
  Next 
  WSCript.Echo "Just killed process " &amp; strProcessKill _
  &amp; " on " &amp; strComputer
  WScript.Quit 
  </code></pre>