Just a quick question.
I use VBScript and WMI to perform tasks on remote machines but am a bit confused about error trapping.
Suppose I've enumerated instances of a particular Win32_Service and now I want to start one with
intReturnCode = objService.StartService()
Do I need to be looking at both the Err object and the value of the return code to see if there has been an error or just one of these?
If Err.Number <> 0 Then
WScript.Echo "Error number " & Err.Number & " - " & Err.Description
ElseIf intReturnCode <> 0 Then
WScript.Echo "Error code " & intReturnCode
WScript.Echo "All was OK"
Obviously this makes code very long if every single thing that might go wrong has to be trapped in two different ways...??