title: How can I call a function in a vbscript with command line arguments?
body: <p>I have a script that executes remotely to see if a program is running. It works fine but I need it to check for several programs on several servers and I don't want to re-write it. I'm trying to see if I can call the function within the vbscript via command line so that I can use 1 script and change the arguments at the command line. </p>
  
  <pre><code>Function IsProcessRunning(strComputer, strProcess)
      Dim Process, strObject
      IsProcessRunning = 0
      strObject   = "winmgmts://" &amp; strComputer
      For Each Process in GetObject( strObject ).InstancesOf( "win32_process" )
      If UCase( Process.name ) = UCase( strProcess ) Then
          IsProcessRunning = 1 
          If IsProcessRunning = 1 Then
              WScript.echo 1 &amp; ": " &amp; strProcess &amp; " is currently running on " &amp; strComputer      
          End If
          Exit Function
      End If
      Next
      WScript.echo 0 &amp; ": " &amp; strProcess " is NOT running on " &amp; strComputer
  End Function
  </code></pre>
  
  <p>What I'm hoping for is to be able to run this via cmd like:
   run.vbs IsprocessRunning Server3 Program2.exe</p>