Error Handling in WMI Script or Visual Basic Applications
If a call to WMI through the WMI API for scripting causes an error, the error information can be accessed using the native error mechanisms of the scripting language. In addition, the provider may supply an SWbemLastError object to give further information on the error.
You can use the following VBScript example to obtain an object by calling CreateObject.
In Visual Basic or VBScript, error handling is supported using the Err object. The Description property of this object will contain a localized human-readable description of the error. The Number property is set to the HRESULT returned by the Scripting API. The Source property is set to a string that identifies the object that raised the error.
Build date: 11/19/2012