Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'WebCheck.vbs - Check website and/or resource availability.
- 'https://www.reddit.com/u/jcunews1
- 'https://pastebin.com/u/jcunews
- 'https://greasyfork.org/en/users/85671-jcunews
- 'timeout in milliseconds (1 second = 1000ms).
- 'for name resolving, site connection, request sending, response waiting.
- timeout = 10000
- if wscript.arguments.count = 0 then
- wscript.echo "Usage: WebCheck {url}" & vbcrlf & vbcrlf & "Exit codes:" & _
- vbcrlf & "100-299 = Site and resource are accessible." & _
- vbcrlf & "300-399 = Site is accessible, unknown resource availability." & _
- vbcrlf & "400-499 = Site is accessible, resource is not found." & _
- vbcrlf & "500-599 = Site error, unknown resource accessibility." & _
- vbcrlf & "1000 = Site not found, or service is unavailable." & _
- vbcrlf & "2000 = Invalid URL."
- wscript.quit
- end if
- set ht = createobject("winhttp.winhttprequest.5.1")
- ht.settimeouts timeout, timeout, timeout, timeout
- on error resume next
- ht.open "HEAD", wscript.arguments(0), false
- if err.number <> 0 then
- wscript.echo err.description
- wscript.quit 2000
- end if
- ht.send
- if err.number <> 0 then
- wscript.echo err.description
- wscript.quit 1000
- else
- wscript.echo err.statustext
- wscript.quit ht.status
- end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement