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

MI_Application_NewSession function

Creates a session used to share connections for a set of operations to a single destination.

Syntax


MI_Result MI_Application_NewSession(
  _In_      MI_Application *application,
  _In_opt_  const MI_Char *protocol,
  _In_opt_  const MI_Char *destination,
  _In_opt_  MI_DestinationOptions *options,
  _In_opt_  MI_SessionCallbacks *callbacks,
  _Outptr_opt_result_maybenull_ MI_Instance **extendedError,
  _Out_     MI_Session *session
);

Parameters

application [in]

A pointer to a handle returned from the MI_Application_Initialize function.

protocol [in, optional]

A pointer to an optional protocol handler to carry out the operation. If this parameter is NULL, a default value is used, based on the destination. Currently supported protocols are L"WMIDCOM" and L"WINRM".

destination [in, optional]

An optional destination for the session. If the destination argument is NULL, the session communicates with the local machine. Otherwise, the destination can be the computer name of the local machine or a remote machine.

options [in, optional]

A pointer to optional destination options, such as default time-outs and credentials.

callbacks [in, optional]

A pointer to an optional MI_SessionCallbacks structure that contains callbacks to receive various results.

extendedError

Pointer to optional additional error information if the operation failed. When you have finished using the error information, free the memory by calling the MI_Instance_Delete function.

session [out]

A pointer to the returned session handle. When you have finished using the session handle, close it by calling the MI_Session_Close function. If the session handle is not closed before shutting down both the application and the application handle, the application handle shutdown will not respond.

Return value

Return codeDescription
MI_RESULT_OK

The operation succeeded.

MI_RESULT_SERVER_LIMITS_EXCEEDED

There is not enough memory to complete the request.

MI_RESULT_INVALID_PARAMETER

One or more parameters passed to the function were not valid.

MI_RESULT_FAILED

A failure not covered by other MI_Result error codes.

 

Remarks

Creating a destination may not communicate with the destination computer. It will not be until the first operation is carried out on a session that the application can determine whether the computer is accessible.

The MI_Session_Close function must be called on the outbound session handle. Close all operations under the target session before closing the session.

If no protocol is specified and destination is NULL, the WMIDCOM protocol is used. If no protocol is specified and destination is not NULL, the WINRM protocol is used.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Redistributable

Windows Management Framework 3.0 on Windows Server 2008 R2 with SP1, Windows 7 with SP1, and Windows Server 2008 with SP2

Header

Mi.h

 

 

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