共用方式為


GetCurrentUser Method in Class SMS_Identification

Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2

In Configuration Manager, the GetCurrentUser Windows Management Instrumentation (WMI) class method gets the domain\user name being used by the SMS Provider for authentication.

The following syntax is simplified from Managed Object Format (MOF) code and is intended to show the definition of the method.

SInt32 GetCurrentUser(
     String UserName
);

Parameters

  • UserName
    Data type: String

    Qualifiers: [out]

    Domain\user name being used by the SMS Provider. This name might differ from the domain\user name supplied by the application, depending on the domain trust model that is used.

Return Values

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

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

Example Code

The following example shows how to call this method to get the current user.

Dim Identification As SWbemObject
Dim UserName As String

Set Identification = GetObject("winmgmts:\root\sms\site_<sitecode>:SMS_Identification")
Identification.GetCurrentUser UserName

MsgBox "UserName = " & UserName

Requirements

Runtime Requirements

For more information, see Configuration Manager Server Runtime Requirements.

Development Requirements

For more information, see Configuration Manager Server Development Requirements.

See Also

Concepts

SMS_Identification Server WMI Class