This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

"Get output failed" and then displays exactly the output I expected

I'm trying to create a monitor script, and no matter what I do, I get "Get output failed". Next to this message is the output that was generated, which is exactly the output I was expecting. I'm extremely confused by this. What am I doing wrong?

My script:

$port = $args.get(0)

$url = "http://${Node.DNS}`:$port"

$req = [system.Net.WebRequest]::Create($url)

try {

    $res = $req.GetResponse()

}

catch [System.Net.WebException] {

    $res = $_.Exception.Response

}

[int]$res.StatusCode

$exitCode = 0

Output:

Output: ==============================================

403