Share via


MSFT_Computer.Name Property

Gets the name of the computer.

 string MSFT_Computer.Name

Access

Read/write

Return Value

String

Examples

The following example shows the use of the Name property.

'*********************************************************************
' Routine: Function GetComputerNameFromGUID
' Purpose: Gets the name of the computer object matching the specified GUID.
' Arguments: The server running MOM, the GUID of the computer.
' Returns: The name of the MSFT_Computer object.
'
'**********************************************************************
Const ERR_BASE = 1100
Const ERR_OBJECT_NOT_FOUND = 7

Function GetComputerNameFromGUID(strServer, strComputerGUID)
    Dim objComputer
    Dim strName

    strName = ""

    Set objComputer = GetObject("WinMgmts://" & strServer & "/root/MOM:MSFT_Computer=""" & strComputerGUID & """")

    If (objComputer Is Nothing) Then
        Err.Description = "Could not find an object matching the specified GUID"
        Err.Number = ERR_BASE + ERR_OBJECT_NOT_FOUND
    Else
        strName = objComputer.Name
    End If

    Set objComputer = Nothing

    GetComputerNameFromGUID = strName
End Function
  

Requirements

Platforms: Requires Windows 2000 Server or later

Version: Requires MOM 2000 SP1 or later

See Also

MSFT_Computer Class