Using the System.Net.Webclient class and using old-fashioned regexp to cull out links:
1 2 3 4 5 6 7 8 |
# create a net.webclient object $web = New-Object system.net.webclient # download the page as a string # split the string wherever you have <a followed by spaces (the link tag basically) # the result of the split is an array; pipe this through a foreach-object block # and match each element with the regexp that ferrets out URLs, and output the matched bit ($web.downloadstring("http://URL/of/page") -split "<a\s+") | %{ [void]($_ -match "^href=[`'`"]([^`'`">\s]*)"); $matches[1] } |