MSFT_Computer.GUID Property

Gets the GUID that identifies the computer.

 string MSFT_Computer.GUID

Access

Read/write

Return Value

String

Remarks

The GUID value is a unique identifier assigned to the object at the time it was created. It is also the key property for this WMI class.

For non-Windows MSFT_Computer objects created through WMI, the GUID property is read/write until the object is saved. After the property value is set and the object is saved, the GUID property becomes read-only.

Examples

The following example shows the use of the GUID 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