I am hoping to validate URLs similar to what can be done for file system and registry paths with Test-Path.
But, of course, Test-Path
doesn't work on a URL, and I have been unable to find a way to do this in PowerShell.
I can use Invoke-WebRequest
, but as far as I can tell there is no validation, I can get a return code of 200 if it's found, or 404 if it's not.
The only exception being an invalid host name, like host,com
, which has me wondering:
Other than an invalid host name, IS there such a thing as an invalid URL?
Or is it basically any character valid in a URL path once the port and host are properly defined?