Create a Process Matching Criterion by Using Path Matching

Applies To: Windows Server 2008 R2

Membership in the local Administrators group, or equivalent, is the minimum required to complete this procedure.

Creating basic process matching criteria by using path matching

The following procedure describes how to create process matching criteria by using path matching for all instances of a specific application.

To create a process matching criterion by using path matching

  1. Open Windows System Resource Manager. To open Windows System Resource Manager, click Start, point to Administrative Tools, and then click Windows System Resource Manager.

  2. In the Connect to Computer dialog box, select This computer, and then click Connect.

  3. In the console tree, right-click Process Matching Criteria, and then click New Process Matching Criteria.

  4. In the New Process Matching Criteria dialog box, in the Criteria name box, type a descriptive name for the new process matching criterion, and then click Add.

Note

A process matching criterion name cannot start with a hyphen (-) and cannot contain spaces or the following characters: , \ / * ; ? : " | - < or >.

  1. In the Add Rule dialog box, on the Files or Command Lines tab, specify the processes, services, or applications to be managed as follows:

    1. To specify the process manually, in the Included files or command lines box, type the file name or command line path.

      —or—

    2. To choose the process from a list, select Registered Service, Running Process, or Application, and then click Select.

    • If you selected Registered Service or Running Process, click the process that you want to match, and then click OK.

    • If you selected Application, type the path to the location of the application executable file (or click Browse to find the application executable file, and then double-click the file).

  2. To exclude processes, services, or applications from management, select the Excluded files or command lines check box, and then do one of the following:

    1. To specify the process manually, in the Excluded files or command lines box, type the file name or command line path.

      —or—

    2. To choose the process from a list, select Registered Service, Running Process, or Application, and then click Select.

    • If you selected Registered Service or Running Process, click the process that you want to match, and then click OK.

    • If you selected Application, type the path to the location of the application executable file (or click Browse to find the application executable file, and then double-click the file).

  3. Repeat steps 5 and 6 as necessary to create additional processes, and then click OK.

Creating advanced process matching criteria by using path matching

You can create advanced process matching criteria by using path matching to:

  • Manage multiple processes that were created by the same executable.

  • Specify process matching based on strings that are passed by the command line.

The process matching criteria in this section use regular expressions.

Managing multiple processes created by the same executable

Some applications, such as Internet Information Services (IIS), start multiple processes from the same .exe file. To distinguish among individual or groups of processes that are started from the same .exe, you must develop specific process matching criteria.

For example, to select an IIS 6.0 Web site with a process matching criterion requires the following information:

  • The name of the .exe of the process that handles IIS 6.0 requests, which is always w3wp.exe.

  • The name of the application pool that corresponds to the Web site that is served by each w3wp.exe process. This name is specified by the user, but for the purposes of this example, it will be called example.

You can now create a process matching criterion that includes the following match string:

@.*w3wp\.exe.*example.*

This string will match any process with a full command-line string that matches anythingw3wp.exeanythingexampleanything, which will match all processes related to the Web site example.

Specifying process matching based on strings passed by the command line

You can specify resource allocations that are based on strings passed on the command line. Use these to create resource-allocation policies that assign varying resource allocations, depending on the arguments passed to the program's .exe. This is illustrated in the following example:

file.exe -switch1:arg1 -switch2:arg2

Using process matching criteria, you can specify that different resource allocations are used, depending on which switch is used. For example, use Resource1 when switch1 is specified, Resource2 when switch2 is specified, and Resource3 when both or neither switch is specified. To do this, you create four process matching criteria, as illustrated in the following table:

Process matching criterion String

PMC-switch1

@.*file\.exe.*switch1:.*

PMC-switch2

@.*file\.exe.*switch2:.*

PMC-switch1and2

@.*file\.exe.*switch1:.*switch2:.*; @.*file\.exe.*switch2:.*switch1:.*

PMC-neitherswitch1nor2

@.file\.exe.*; !@.*file\.exe.*switch1:.*; !@.*file\.exe.*switch2:.*

The process matching criteria must be ordered as follows in the resource allocation policy to accomplish the management goal:

Process matching criterion Resource allocation

PMC-neitherswitch1nor2

Resource3

PMC-switch1and2

Resource3

PMC-switch1

Resource1

PMC-switch2

Resource2

Additional considerations

  • Windows System Resource Manager supports the following environment variables in process matching criteria: WINDIR, PROGRAMFILES, TMP, and TEMP.

  • If you type an environment variable as part of a command at a command prompt, you must bracket the variable with carets(^) as shown in the following example:

    ^%windir%^
    

    This prevents the environment variable from being expanded by the shell on the client.

  • You do not have to use carets if you specify environment variables while creating process matching criteria by using the Windows System Resource Manager snap-in.

Additional references