WSMan.CreateResourceLocator method

Creates a ResourceLocator object that can be used instead of specifying a resource URI in Session object operations such as Session.Get, Session.Put, or Session.Enumerate.

Syntax

WSMan.CreateResourceLocator( _
  [ ByVal uri ] _
)

Parameters

uri [in, optional]

The resource URI for the resource. For more information about URI strings, see Resource URIs.

Return value

A ResourceLocator object that can then be used to perform local or remote WinRM operations.

Remarks

If the FragmentDialect property is not specified in the ResourceLocator object, the default is the XPath 1.0 specification. For more information, see https://www.w3.org/TR/xpath.

Examples

The following VBScript code example creates a ResourceLocator object and gets the network adapter Description property value from the instance of Win32_NetworkAdapterConfiguration with an Index of "1".

const Uri = "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_NetworkAdapterConfiguration"
const FragmentPath = "Description"

Set objWSMan = CreateObject("WSMan.Automation")

Set objSession = objWSMan.CreateSession()

Set objLocator = objWSMan.CreateResourceLocator(Uri)

objLocator.AddSelector "Index", "1"
objLocator.FragmentPath = FragmentPath

Dim Xml
Xml = objSession.Get(objLocator)
WScript.Echo Xml

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
WSManDisp.h
IDL
WSManDisp.idl
Library
WSManDisp.tlb
DLL
WSMAuto.dll

See also

WSMan

ConnectionOptions

Session