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.

Methods

The WSMan object defines the following methods.

MethodDescription

CreateSession

Creates a Session object that can then be used for subsequent network operations.

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.

WSMan.EnumerationFlagNonXmlText

Returns the value of the enumeration constant WSManFlagNonXmlText for use in the flags parameter of the Session.Enumerate method.

WSMan.EnumerationFlagHierarchyDeepBasePropsOnly

Returns the value of the enumeration flag EnumerationFlagHierarchyDeepBasePropsOnly for use in the flags parameter of Session.Enumerate.

WSMan.EnumerationFlagReturnEPR

Returns the value of the enumeration flag EnumerationFlagReturnEPR 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.EnumerationFlagHierarchyDeep

Returns the value of the enumeration flag EnumerationFlagHierarchyDeep 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.EnumerationFlagReturnObject

Returns the value of the enumeration flag EnumerationFlagReturnObject for use in the flags parameter of Session.Enumerate.

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.GetErrorMessage

Returns a formatted string containing the text of an error number.

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 defines the following properties.

PropertyAccess typeDescription

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

Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2008
RedistributableWinRM v1.1 (Windows Server 2003 R2, Windows Server 2003 with SP1, or Windows XP with SP2)
HeaderWsmandisp.h
IDLWsmandisp.idl
LibraryWSManAutomation
DLLWsmauto.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

Send comments about this topic to Microsoft

Build date: 11/2/2009

Tags :


Community Content

Noelle Mallory - MSFT
C# examples for WSMan (WinRM) API's?

Are there any examples of using the IWSMan interface in C#? All I can find are VB scripts and I can't find a class that implements the IWSMan interface.

[Noelle Mallory - MSFT] Please post questions to the MSDN Forums at http://forums.microsoft.com/msdn. You will likely get a quicker response through the forum than through the Community Content.


Page view tracker