title: Find a service with Partial name VBS
body: <p>We have a service that runs with different names on different machines like </p>
  
  <p>Bomgar-scadsadccd, Bomgarsdscchfn, Bomgarscnkfkdk</p>
  
  <p>So, here we need to write a VB script that will find this service with partial name "Bomgar" 
  and check it's status like</p>
  
  <p>1) Not present, then should install from a shared folder like "start \10.216.16.245\Bomgar.exe"
  2) Installed but not running, then start the service.
  3) Installed and running then quit.</p>
  
  <p>How can we achieve this?</p>
  
  <pre><code>strComputer = "."
  Set objWMIService = GetObject("winmgmts:" _ 
      &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\cimv2") 
  
  Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service where Name='bomgar*'") 
  nItems = colRunningServices.Count 
  
  If nItems &gt; 0 Then 
      For Each objItem in colRunningServices 
          If objItem.State = "Stopped" Then 
              objItem.startservice
          ElseIf objItem.State = "Running" Then
              exit
          End If
      Next
  Else
      start \\10.18.23.245\Shared\Bomgar.exe
  End If
  </code></pre>