Rediger

Del via


WSMan object

Provides methods and properties used to create a session, represented by a Session object. Any Windows Remote Management operations require creation of a Session that connects to a remote computer, base management controller (BMC), or the local computer. Operations include getting, writing, enumerating data, or invoking methods.

Members

The WSMan object has these types of members:

Methods

The WSMan object has these methods.

Method Description
CreateConnectionOptions Creates a ConnectionOptions object that specifies the user name and password used when creating a remote session.
CreateResourceLocator Creates a ResourceLocator object that can specify:
  • The complete path to a resource or a single piece of data.
  • A selector for a specific instance of a resource.
  • An option that supplies additional data to the resource provider.
CreateSession Creates a Session object that can then be used for subsequent network operations.
WSMan.EnumerationFlagHierarchyDeep Returns the value of the enumeration flag EnumerationFlagHierarchyDeep for use in the flags parameter of Session.Enumerate.
WSMan.EnumerationFlagHierarchyDeepBasePropsOnly Returns the value of the enumeration flag EnumerationFlagHierarchyDeepBasePropsOnly for use in the flags parameter of Session.Enumerate.
WSMan.EnumerationFlagHierarchyShallow Returns the value of the enumeration flag EnumerationFlagHierarchyShallow for use in the flags parameter of Session.Enumerate.
WSMan.EnumerationFlagNonXmlText Returns the value of the enumeration constant WSManFlagNonXmlText for use in the flags parameter of the Session.Enumerate method.
WSMan.EnumerationFlagReturnEPR Returns the value of the enumeration flag EnumerationFlagReturnEPR for use in the flags parameter of Session.Enumerate.
WSMan.EnumerationFlagReturnObject Returns the value of the enumeration flag EnumerationFlagReturnObject for use in the flags parameter of Session.Enumerate.
WSMan.EnumerationFlagReturnObjectAndEPR Returns the value of the enumeration flag EnumerationFlagReturnObjectAndEPR for use in the flags parameter of Session.Enumerate.
WSMan.GetErrorMessage Returns a formatted string containing the text of an error number.
WSMan.SessionFlagCredUsernamePassword Returns the value of the authentication flag WSManFlagCredUsernamePassword for use in the flags parameter of WSMan.CreateSession.
WSMan.SessionFlagEnableSPNServerPort Returns the value of the authentication flag WSManFlagEnableSPNServerPort for use in the flags parameter of WSMan.CreateSession.
WSMan.SessionFlagNoEncryption Returns the value of the authentication flag WSManFlagNoEncryption for use in the flags parameter of WSMan.CreateSession.
WSMan.SessionFlagSkipCACheck Returns the value of the WSManFlagSkipCACheck authentication flag for use in the flags parameter of WSMan.CreateSession.
WSMan.SessionFlagSkipCNCheck Returns the value of the authentication flag WSManFlagSkipCNCheck for use in the flags parameter of WSMan.CreateSession.
WSMan.SessionFlagUseBasic Returns the value of the authentication flag WSManFlagUseBasic for use in the flags parameter of WSMan.CreateSession.
WSMan.SessionFlagUseDigest Returns the value of the authentication flag WSManFlagUseDigest for use in the flags parameter of WSMan.CreateSession.
WSMan.SessionFlagUseKerberos Returns the value of the authentication flag WSManFlagUseKerberos for use in the flags parameter of WSMan.CreateSession.
WSMan.SessionFlagUseNegotiate Returns the value of the authentication flag WSManFlagUseNegotiate for use in the flags parameter of WSMan.CreateSession.
WSMan.SessionFlagUseNoAuthentication Returns the value of the authentication flag WSManFlagUseNoAuthentication for use in the flags parameter of WSMan.CreateSession.
WSMan.SessionFlagUTF8 Returns the value of the authentication flag WSManFlagUTF8 for use in the flags parameter of WSMan.CreateSession.

Properties

The WSMan object has these properties.

Property Access type Description
CommandLine
Read-only
Gets the unprocessed command line for the current hosting process.
Error
Read-only
Gets error information.

Remarks

The WSMan object corresponds to the IWSMan and IWSManEx interfaces. WSMan is the only object that can be created directly using CreateObject.

Examples

The following code example shows how to instantiate a WSMan object.

Dim objWsman
Dim Session, Resource 
Set objWsman = CreateObject( "WSMAN.Automation" )
Set Session = objWsman.CreateSession
strResource = "http://schemas.microsoft.com/wbem/wsman/1/wmi/Root/CIMv2/Win32_OperatingSystem"

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

WinRM Scripting API

About Windows Remote Management

Using Windows Remote Management

Scripting in Windows Remote Management

Obtaining Data from the Local Computer

Obtaining Data from a Remote Computer