Last active
July 15, 2024 22:31
-
-
Save dfinke/4467657 to your computer and use it in GitHub Desktop.
Uses PowerShell v3 to find the free chapters of "PowerShell in Depth" and downloads the PDF
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
$url="http://www.manning.com/jones2/" | |
(Invoke-WebRequest $url).links | where onclick -match 'free' | foreach { | |
[PSCustomObject] @{ | |
innerHTML = $_.innerHTML | |
FullHref = $url+$_.href | |
href = $_.href | |
url = $url | |
} | |
} | ForEach { | |
$outFile = "c:\temp\$($_.href)" | |
"Downloading $($_.InnerHtml) -> $($outFile)" | |
Invoke-WebRequest $_.FullHref -OutFile $outFile | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Small Hack, but I am not able to save the file with 4567.ps1 or advanced event.ps1
download all scripting games code by Rohn Edwards
$url="http://2012sg.poshcode.org/Scripts/By/862"
(Invoke-WebRequest$url).links | where{$ .innerHTML -eq "Download"} | ForEach {$_.InnerHtml) -> $ ($outFile)"
$outFile = "c:\temp$($.outerText)"
#"Downloading $(
$callstring = "http://2012sg.poshcode.org"+$_.href
$callstring
Invoke-WebRequest $callstring -OutFile $outFile
}