WKSPath

(Engine-Level Function)

Description: Given set of path components, generates a query path for use in the WKSStatus command.
Returns: Text
Usage: Script Only.
Function Groups: Hardware and Software,  Network
Related to: WKSList | WKSStatus | WKStaInfo
Format: WKSPath(MachineName, ObjectName[, InstanceName, ParentInstance, InstanceIndex, CounterName)
Parameters:  
MachineName   
Required. The name of the computer to query. Can be obtained dynamically using the function call, WkStaInfo(0);
ObjectName   

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

The ObjectName must be in the locale language (the language that the user account is in). For example, using an English string on a French user account will return an error.

InstanceName  
The name of the instance of the system object to query. The wildcard, * may be used to query all instances.
ParentInstance    
The name of the parent instance of the system object. The wildcard, * may be used to query all parent instances.
InstanceIndex   
An integer assigned to the system object, if unnamed.
CounterName    
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. The parameters to this function and the resulting query path are best understood in the context of the Windows™ Performance Monitor.
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 function }
    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);
  ]