top of page

PowerShell Script to get list of links on a webpage

Note that you can run a PowerShell script to get a list of all of the hyperlinks on a web page. On any PC running Windows 10, open PowerShell ISE, and simply put this script:


(Invoke-WebRequest -Uri “https://www.supremecourt.gov/opinions/slipopinion/20”).Links | sort-object href -Unique | Format-List innerText, href


. . . in the Script Pane, the white area on the top. (Display this area under the View menu, if you don't see it after opening PowerShell.) The actual web address, as you can see, is entered after '-Uri' in double quotes.


So from this web page:


. . . we get these results after pressing the play button on the toolbar in PowerShell.





Comments


bottom of page