SWbemObjectPath.Namespace property

The Namespace property of the SWbemObjectPath object contains the name of the namespace that is part of the object path. For example, the following path shows the namespace property that returns root\cimv2:

\\computer\root\cimv2:win32_logicaldisk="a:"

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

This property is read/write.

Syntax

SWbemObjectPath.Namespace As String

Property value

Examples

The following example shows you how to obtain the namespace name from instances of Win32_LogicalDisk that are hard disks. The script connects to the default namespace.

Const HARD_DISK = 3
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer)

Set colDisks = objWMIService.ExecQuery _
    ("Select * from Win32_LogicalDisk " _
    & "Where DriveType = " & HARD_DISK & "")
For Each objDisk in colDisks
    Set objpath = objDisk.path_
    Wscript.Echo "Path of Win32_Logical disk instance " _
    & objDisk.DeviceID & " = " & objpath.Namespace   
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_SWbemObjectPath
IID
IID_ISWbemObjectPath