Check if a URL is responding

I’m looking to pull back a twice a day check on a PC or server of whether a computer has internet access. Like a Property in bigfix like HasInternetAccess True or False type rerponse. My thought was to query and if I get a 200 it has internet access and if not, it does not. Any ideas how to do this? FYI, this is not for monitoring internet, it’s for auditing internet access on certain PCs/Servers.

Write a little script using your choice of utility - powershell, wget, curl, etc - and write the output to a file. Then you can parse the output in an analysis or with relevance of follow-up tasks.

1 Like

something like this actionscript duo?

download now as google.txt
continue if "{exists lines whose (it contains "Google")  of file "__Download/google.txt"}"

Thanks for the suggestions, I like the download now and the powershell to file. I was even thinking powershell to registry.

I’m toying with this concept now. Anything that would be more elegant?

if ((Property "StatusCode" of select object "StatusCode From Win32_PingStatus Where Address = ''" of wmi) as string = "StatusCode=0") then ("True") else ("False")

1 Like

OK, i thought about this more and what about computers where ping outbound is blocked. So looked up the WMI in windows to check it’s connectivity status. Then I changed the code to support multiple NICs. But… I think it’s sloppy. Is there a way to more elegantly check a list of results and evaluate to True if “ANY” match your criteria?

Example, check the IPv4Connectivity FROM MSFT_NetConnectionProfile, but if any match “4” then evaluate to true. I feel my code works, but it’s probably not elegant. I’m looking to learn here!

If ((concatenation ";" of ((selects "IPv4Connectivity FROM MSFT_NetConnectionProfile" of wmis "ROOT\StandardCimv2") as String)) contains "IPv4Connectivity=4") Then ("True") Else ("False")

I like the pivot.

Here is a little cleaner way to relevance it.

q: exists selects "IPv4Connectivity FROM MSFT_NetConnectionProfile" whose (string value of it = "4") of wmis "ROOT\StandardCimv2"
A: True
1 Like