MI_Session_CreateInstance function (mi.h)

Creates an instance on the server that the session represents.

Syntax

MI_INLINE void MI_Session_CreateInstance(
  [in]           MI_Session            *session,
                 MI_Uint32             flags,
  [in, optional] MI_OperationOptions   *options,
                 const MI_Char         *namespaceName,
  [in]           const MI_Instance     *inboundInstance,
  [in, optional] MI_OperationCallbacks *callbacks,
  [out]          MI_Operation          *operation
);

Parameters

[in] session

Session handle returned from MI_Application_NewSession.

flags

Runtime type information (RTTI) flags.

[in, optional] options

Optional MI_OperationOptions value that specifies options such as timeouts and how to control the CIM semantics. Specify Null if no operation options are to be sent.

namespaceName

A null-terminated string that contains the optional namespace name to carry out the operation. If none is specified, the server will pick a default. The namespace cannot include a computer name. It can only be in the form of a namespace name separated by a slash mark character (/). For example, the following would be a valid namespaceName value: root/cimv2.

[in] inboundInstance

MI_Instance that represents the class name and keys of the instance to be created on the server along with the rest of the properties of the instance that destination instance will be set to. Sometimes keys are read-only, so not all keys need to be specified. If the instance that is specified already exists, the function will fail; to update an existing instance, use the MI_Session_ModifyInstance function.

[in, optional] callbacks

Optional MI_OperationCallbacks structure that defines the operational callbacks to receive the instance result and CIM semantics. To do asynchronously, this value must be specified. If NULL is specified, the client must call the MI_Operation_GetInstance function to retrieve the results.

[out] operation

Operation handle that must be closed with a call to MI_Operation_Close once the operation is finished and all results have been received. The handle can be used to cancel the operation with a call to MI_Operation_Cancel.

Return value

None

Requirements

Requirement Value
Minimum supported client Windows 8
Minimum supported server Windows Server 2012
Target Platform Windows
Header mi.h
Redistributable Windows Management Framework 3.0 on Windows Server 2008 R2 with SP1, Windows 7 with SP1, and Windows Server 2008 with SP2

See also

MI_Operation_Cancel

MI_Operation_Close

MI_Operation_GetInstance

MI_Session_ModifyInstance