Share via


MSFT_Computer.UpdateContactTime Method

Updates the time when the last heartbeat was received from a computer.

 MSFT_Computer.UpdateContactTime()

Parameters

None

Return Value

Unsigned 32-bit integer

Remarks

This method works only for computers that have been created and added through MOM APIs.

In cases where a computer managed by MOM does not have an agent, it will not send regular heartbeats back to the server running MOM. For example, when you monitor a UNIX computer using the syslog event data provider, heartbeats are not sent.

Examples

The following example shows the use of the UpdateContactTime method.

'*********************************************************************
' Routine: Function SendHeartBeat
' Purpose: Updates the last time when the server recorded contact with
'          a non-Windows computer.
' Arguments: The server running MOM, the computer GUID.
' Returns: The scan status.
'
'**********************************************************************
Const TYPE_NONWINDOWS = 8192

Function SendHeartBeat(strMOMServer, strComputerGuid)
    Dim objComputer
    Dim lngStatus

    lngStatus = -1

    Set objComputer = GetObject("WinMgmts://" & strMOMServer & "\root\MOM:MSFT_Computer='" & strComputerGuid & "'")

    If Not(objComputer Is Nothing) Then
        If (objComputer.Type = TYPE_NONWINDOWS) Then
            WScript.Echo("Sending heartbeat for: " & objComputer.Domain & "\" & objComputer.Name)
            lngStatus = objComputer.UpdateContactTime()
        End If
    End If

    Set objComputer = Nothing

    SendHeartBeat = lngStatus
End Function
  

Requirements

Platforms: Requires Windows 2000 Server or later

Version: Requires MOM 2000 SP1 or later

See Also

MSFT_Computer Class