CreateRelationship Method in Class SMS_UserMachineRelationship


Applies To: System Center 2012 Configuration Manager, System Center 2012 Configuration Manager SP1, System Center 2012 R2 Configuration Manager

The CreateRelationship Windows Management Instrumentation (WMI) class method, in System Center 2012 R2 Configuration Manager, creates a relationship between a user and a device.

The following syntax is simplified from Managed Object Format (MOF) code and defines the method.


sint32 CreateRelationship (
     uint32 MachineResourceId,
     string UserAccountName,
     uint32 SourceId,
     uint32 TypeId


  • MachineResourceId
    Data type: UInt32

    Qualifiers: [in]

    Unique Configuration Manager-supplied identifier for the resource.

  • UserAccountName
    Data type: String

    Qualifiers: [in]

    User account name.

  • SourceId
    Data type: UInt32

    Qualifiers: [in]

    Source object identifier for dependency.

    Software Catalog

    The end user enabled the relationship by selecting the option in the AppCatalog Web page.


    An administrator created the relationship manually in the UI.



    Usage Agent

    The threshold of activity triggered a relationship to be created.

    Device Management

    The user/device were tied together during enrollment.


    The user/device were tied together as part of OSD imaging.

    Fast Install

    The user/device were tied together temporarily to enable an on-demand install from the catalog if no UDA relationship installed before the Install was triggered.

    Exchange Server connector

    The device was provisioned through EAS.

  • TypeId
    Data type: UInt32

    Qualifiers: [in, optional]

    Type identifier.

Return Values

An SInt32 data type that is 0 to indicate success or non-zero to indicate failure.

For more information about handling returned errors, see About Configuration Manager Errors.


Runtime Requirements

For more information, see Configuration Manager Server Runtime Requirements.

Development Requirements

For more information, see Configuration Manager Server Development Requirements.

See Also

SMS_Application Server WMI Class
Configuration Manager Application Management Server WMI Classes