title: VBS: Terminate multiple running applications
body: <p>I am trying to close multiple applications at the same time using the following VBS script, but am getting the error <code>0x80041017</code> on the <code>For Each</code> loop line. It works fine with just one application but I added another to terminate</p>
  
  <pre><code>strComputer = "."
  strProcessToKill1 = "Acrobat.exe" 
  strProcessToKill2 = "iexplore.exe" 
  
  Set objWMIService = GetObject("winmgmts:" _
                  &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\cimv2") 
  
  Set colProcess = objWMIService.ExecQuery _
                  ("Select * from Win32_Process Where Name = '" &amp; strProcessToKill1 &amp; "' or '" &amp; strProcessToKill2 &amp; "'")
  
  
  count = 0
  For Each objProcess in colProcess
                  objProcess.Terminate()
                  count = count + 1
  Next 
  </code></pre>