On Error Resume Next not working on GetObject WMI

Home Forums Scripting General Scripting On Error Resume Next not working on GetObject WMI

Viewing 1 post (of 1 total)
  • Author
    Posts

  • humbletech99
    Member
    #129380

    I have a script with the following code block:

    Code:

    Err.Clear
    On Error Resume Next
    Set objWMIService = GetObject(“winmgmts:\” & strServer & “rootCIMV2”)
    If Err.Number Then

    End If

    However, when I run it where strServer = nonExistantMachine I get a complete lack of error handling:

    Code:
    (290, 14) Microsoft VBScript runtime error: The remote server machine does not exist or is unavailable

    Why is this occurring if I have told it to continue on error so that I can handle it myself?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

13 Email Threat Types to Know About Right Now

As email threats evolve and multiply, keeping track of them all—and staying protected against the many different types—becomes a complex challenge. Today, that requires more than just the traditional email gateway solution that used to be good enough.

In this eBook you will learn:

  • What are the most common and challenging email attacks for organizations?
  • How to defend against sophisticated email threats, such as spoofing, social engineering, and fraud
  • How to protect employees at the inbox level with the right technologies and security-awareness training
  • How to use a multilayered protection strategy to reduce susceptibility to email attacks and better defend your business and employees

Sponsored by: