By Request VBS Script To Trap Error Numbers And Their Equivalent HEX Value

 

This By Request VBS script was created as an example of how you can trap or see both the error number and its Hex equivalent for a specified error. I also added the Error description as well.

 

VBS Script:

 

On Error Resume Next

 

strComputer = "BogusMachineName"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CimV2")

 

If Err.Number <> 0 Then

MsgBox "Error Description: " & Err.Description & VbCr _

& "Error Number: " & Err.Number & VbCr _

& "Hex Error: " & Hex(Err.Number)

Err.Clear

End If

 

 

 

Published Sunday, May 18, 2008 7:23 AM by dhite
Filed under:

Comments

No Comments