Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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 http://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

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Redistributable

WinRM 1.1 (Windows Server 2003 R2, Windows Server 2003 with SP1, or Windows XP with SP2)

Header

Wsmandisp.h

IDL

Wsmandisp.idl

Library

WSManAutomation.lib

DLL

Wsmauto.dll

See also

WSMan
ConnectionOptions
Session

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.