Skip to content

Latest commit

 

History

History
85 lines (58 loc) · 2.6 KB

swbemobjectpath-namespace.md

File metadata and controls

85 lines (58 loc) · 2.6 KB
description ms.assetid ms.tgt_platform title ms.topic ms.date topic_type api_name api_type api_location
The Namespace property of the SWbemObjectPath object contains the name of the namespace that is part of the object path.
be88670d-6f0d-4b9d-886f-3e70bf4758ed
multiple
SWbemObjectPath.Namespace property (Wbemdisp.h)
reference
05/31/2018
APIRef
kbSyntax
SWbemObjectPath.Namespace
ISWbemObjectPath.Namespace
ISWbemObjectPath.get_Namespace
ISWbemObjectPath.put_Namespace
COM
Wbemdisp.dll

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