Редагувати

Поділитися через


SWbemObject.Path_ property

The Path_ property of the SWbemObject object returns an SWbemObjectPath object that represents the object path of the current class or instance. This property can be passed as a parameter to methods that require an object path.

For an explanation of this syntax, see Document Conventions for the Scripting API.

This property is read-only.

Syntax

SWbemObject.Path_ As Object

Property value

Remarks

Only the Class property of the returned SWbemObjectPath instance can be modified. If you try to modify any other property, or try to call the methods SetAsClass or SetAsSingleton, you will get a wbemErrReadOnly error.

Because of this, you cannot modify the SWbemNamedValueSet object that is the value of the Keys property of the returned SWbemObjectPath instance. If you try to call the Add, Remove, or DeleteAll methods on this value, you will get a wbemErrReadOnly error. Furthermore, you cannot modify any SWbemNamedValue obtained from this collection. Attempts to modify the Value property return the same error code.

However, if you call SWbemObject.Clone_ to create a copy, the SWbemObjectPath.Path property of the copy is fully modifiable.

Examples

The following code sample uses the Path_ property to list all the WMI cimV2 classes.

strComputer = "." 
Set objWMIService=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _  
    strComputer & "\root\cimv2") 
  
For Each objclass in objWMIService.SubclassesOf() 
    Wscript.Echo objClass.Path_.Class 
Next 

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Wbemdisp.h
Type library
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemObject
IID
IID_ISWbemObject