WKSPath 

Description:              Given set of path components, generates a query path for use in the WKSStatus command.

The parameters to this function and the resulting query path are best understood in the context of the Windows™ Performance Monitor.

Returns:                    Text

Usage:                       Script

Format:                      WKSPath(MachineName, ObjectName[, InstanceName, ParentInstance, InstanceIndex, CounterName)

Parameters:             MachineName     { text }  { required }  { no default: }

                                      The name of the computer to query. Can be obtained dynamically using the function call, WkStaInfo(0);

                              ObjectName     { text }  { required }  { no default: }

                                      The system object to query. (corresponds to the objects in the top list in the provided image).  “Processor” is an example.

                              InstanceName     { text }  { optional }  { no default: }

                                      The name of the instance of the system object to query.  The wildcard, * may be used to query all instances.

                              ParentInstance     { text }  { optional }  { no default: }

                                      The name of the parent instance of the system object. The wildcard, * may be used to query all parent instances.

                              InstanceIndex     { numeric  }  { optional }  { no default: }

                                      An integer assigned to the system object, if unnamed.

                              CounterName     { text }  { optional }  { no default: }

                                      The name of the data item to query from the system object.  The wildcard, * may be used to query all sub items of the system object.

Comments:               If the optional parameters are to be included but not specifically set, then wildcard values must be provided.  For text parameters, use the asterisk *,  and for numeric parameters, use -1. 

                                    The output from WKSPath will usually be passed to WKSList for further processing, then to WKSStatus to use to query workstation status.

                                    Returns a Windows™ PDH error code upon failure. This is a long integer containing a 32-bit code.

Example

  If 1 Main;

  [

    MachineName    = WkStaInfo(0);  { Set up some defaults }

    ObjectName     = "Processor";

    InstanceName   = "*";      { These last four match the

                                 native defaults of the WKSPath DAG }

    ParentInstance = "*";

    InstanceIndex  = "0";

    CounterName    = "*";

  ]

]

 

Main [

  If ZButton(10, 70, 950, 50, "Create Query", 7);

  [   { Converts a set of parameters into a query string }

    Query = WKSPath(MachineName, ObjectName, InstanceName,

                    ParentInstance, InstanceIndex, CounterName);

  ]

See Also:

WkSList | WksStatus | WkStaInfo