WMI.ProcessExists Method

Applies to TestComplete 14.70, last modified on April 22, 2021

Description

This method checks if the specified process is running on a computer specified by the WMI.ComputerName property and returns a boolean value indicating the result of the check.

Declaration

WMI.ProcessExists(ProcessName)

ProcessName [in]    Required    String    
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

ProcessName

The name of the process’s executable file, including the extension. For example, notepad.exe. The name is case-insensitive.

Result Value

True if the specified process is running on the target computer and False otherwise.

Example

JavaScript, JScript

...

if (WMI.ProcessExists("iexplore.exe"))
  Log.Message ("iexplore is running")
else
  Log.Message ("iexplore is not running");
...

Python

...

if (WMI.ProcessExists("iexplore.exe")):
  Log.Message("iexplore is running")
else:
  Log.Message("iexplore is not running")
...

VBScript

...
If WMI.ProcessExists("iexplore.exe") Then
  Log.Message ("iexplore is running")
Else
  Log.Message ("iexplore is not running")
End If
...

DelphiScript

...

if WMI.ProcessExists('iexplore.exe') then
  Log.Message ('iexplore is running')
else
  Log.Message ('iexplore is not running');
...

C++Script, C#Script

...

if (WMI["ProcessExists"]("iexplore.exe"))
  Log["Message"] ("iexplore is running")
else
  Log["Message"] ("iexplore is not running");
...

See Also

ComputerName Property
CreateProcess Method

Highlight search results