SP Website availabity PS script returns undesired results

I have a PS script which monitors the availability of my SharePoint 2007 websites. The script also emails me if any of the SharePoint urls isn’t loading or isn’t up. I’m monitoring four sharepoint websites. If I ping a site that I don’t have access to, I receive a 401 unauthorized error. The site is up it’s just that I don’t have access to the site. I understand why I receive the error, but I would like to bypass that somehow. I would like to tweak my code that shows a ping success for an url even though the url displays a http 401 unathorized message. Any ideas?

do { function Test-Site { param($URL) trap{ "Failed. Details: $($_.Exception)" Write-Host "Sending email notification." # if the ping is unsuccessful the following line will pause the script for n seconds, so that we do not get multiple emails Start-Sleep -s 3600} $webclient = New-Object Net.WebClient # The next 5 lines are required as our network has a proxy server $webclient.Credentials = [System.Net.CredentialCache]::DefaultCredentials if($webclient.Proxy -ne $null) { $webclient.Proxy.Credentials = ` [System.Net.CredentialCache]::DefaultNetworkCredentials } # This is the main call $webclient.DownloadString($URL) | Out-Null } Test-Site "http://dev.sample.com" Test-Site "http://dev.sample.com:81" Test-Site "(http)://dev.sample.com:845" Test-Site "(http)://dev.sample.com:11" $response = "Y" } while ($response -eq "Y") Also, I don't have any access to http://dev.sample.com:81 but when I ping this server, I don't receive any error messages. Any ideas?

You need Home - Todd Klindt's home page Todd Klindt he may even have some scripts already on his blog that do what you need to do.

-VERN