' Listing 11: The WMIConnection Function Private Function WMIConnection(strComputer, strLComputer) If strComputer = strLComputer Then Exit Function Else Const WBEM_FLAG_CONNECT_USE_MAX_WAIT = &H80 On Error Resume Next Dim objSWbemLocator, objWMIService ' ******* BEGIN CALLOUT A ******* Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = objSWbemLocator.ConnectServer _ (strComputer,"root\CIMV2","","","","", _ WBEM_FLAG_CONNECT_USE_MAX_WAIT) ' ******* END CALLOUT A ******* If Err.Number <> 0 Then WMIConnection = "Error: " & Hex(Err.Number) & _ ". " & Err.Description & "." End If End If Err.Clear On Error Goto 0 Set objSWbemLocator = Nothing: Set objWMIService = Nothing End Function