共用方式為


CimSession.CreateInstance Method (String, CimInstance, CimOperationOptions)

 

Creates an instance on the server that the session represents.

Namespace:   Microsoft.Management.Infrastructure
Assembly:  Microsoft.Management.Infrastructure (in Microsoft.Management.Infrastructure.dll)

Syntax

public CimInstance CreateInstance(
    string namespaceName,
    CimInstance instance,
    CimOperationOptions options
)
public:
CimInstance^ CreateInstance(
    String^ namespaceName,
    CimInstance^ instance,
    CimOperationOptions^ options
)
member CreateInstance : 
        namespaceName:string *
        instance:CimInstance *
        options:CimOperationOptions -> CimInstance
Public Function CreateInstance (
    namespaceName As String,
    instance As CimInstance,
    options As CimOperationOptions
) As CimInstance

Parameters

  • namespaceName
    Type: System.String

    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.

  • instance
    Type: Microsoft.Management.Infrastructure.CimInstance

    A CimInstance object 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 the 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 ModifyInstance method.

Return Value

Type: Microsoft.Management.Infrastructure.CimInstance

Newly created CimInstance object.

See Also

CreateInstance Overload
CimSession Class
Microsoft.Management.Infrastructure Namespace

Return to top