Session object

Defines operations and session settings. Any Windows Remote Management operations require creation of a Session that connects to a remote computer, base management controller (BMC), or the local computer. WinRM network operations include getting, writing, or enumerating data, or invoking methods. The methods of the Session object mirror the basic operations defined in the WS-Management protocol.

Members

The Session object has these types of members:

Methods

The Session object has these methods.

Method Description
Create Creates a new instance of a resource and returns the URI of the new object.
Delete Deletes the resource specified in the resource URI.
Enumerate Enumerates a collection, table, or message log resource.
Get Retrieves a resource from the service and returns an XML representation of the current instance of the resource.
Identify Queries a remote computer to determine if it supports the WS-Management protocol
Invoke Invokes a method that returns the results of the method call.
Put Updates a resource.

Properties

The Session object has these properties.

Property Access type Description
BatchItems
Read/write
Sets and gets the number of items in each enumeration batch. This value cannot be changed during an enumeration. By default, the default is an unlimited number of items. The resource provider may set a limit.
Error
Read-only
Gets additional error information in an XML stream.
Timeout
Read/write
Sets and gets the maximum amount of time (in milliseconds) for the client application to wait.

Remarks

The Session object corresponds to the IWSManSession interface.

Examples

The following VBScript code example shows how to create a Session object.

' Create a WSMan object.
Dim objWsman 
Set objWsman = CreateObject( "WSMAN.Automation" )

' Create Session object.
Dim objSession
Set objSession = objWsman.CreateSession

Requirements

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