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 |
|
IDL |
|
Library |
|
DLL |
|
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for