Created
January 7, 2014 14:13
-
-
Save normansolutions/8299854 to your computer and use it in GitHub Desktop.
For use on blog post: http://www.normansolutions.co.uk/post/using-powershell-to-check-all-pages-in-website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clear-Host | |
$hsg = Invoke-WebRequest -Uri http://www.stmarys.eu/sitemap.aspx | |
$links = $hsg.Links | Where class -eq 'rmLink' | select href | |
$linksWithDomain = $links | Foreach-Object{"http://www.stmarys.eu/" + $_.href} | |
$linksWithDomain | foreach{ | |
$webClient = new-object System.Net.WebClient | |
$webClient.Headers.Add("user-agent", "PowerShell Script") | |
$output = "" | |
$output = $webClient.DownloadString($_.toString()) | |
if ($output -like "*supportLists*") { | |
"Dodgy Code On Page " + ($_.tostring()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment