Free and legal..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
<# Downloads all ebooks and files mentioned here: http://blogs.msdn.com/b/mssmallbiz/archive/2015/07/07/i-m-giving-away-millions-of-free-microsoft-ebooks-again-including-windows-10-windows-8-1-windows-8-windows-7-office-2013-office-365-sharepoint-2013-dynamics-crm-powershell-exchange-server-lync-2013-system-center-azure-clo.aspx 24 July 2015 - Freek ten Broek #> Param( [string]$url = "http://www.mssmallbiz.com/ericligman/Key_Shorts/MSFTEbooks2.txt", [string]$downloadPath = "d:\ebooks\" ) Add-Type -AssemblyName System.Web # Create downloadfolder if it doesn't exist if ((Test-Path -Path $downloadPath) -ne $true) { New-Item $downloadPath -ItemType Directory | Out-Null } # Open the txt file with all the ebook links $response = Invoke-WebRequest -Uri $url $response | % { # Create an array of the links from the text file $urls = $_.content -split "`r`n" $linkCount = $urls.Count $urls | % { Write-Progress -id 1 -Activity "Processing: $linkCount links" -Status "$i of $linkCount" -PercentComplete $([Math]::Round( ( ($i / $linkCount ) * 100) )) if ($_ -like "http://*") { $response = Invoke-WebRequest -Uri $_ # Get the original filename from the redirect destination response. # Use UrlDecode to strip %20 from url to construct filename $fileName = [System.Web.HttpUtility]::UrlDecode([System.IO.Path]::GetFileName($response.BaseResponse.ResponseUri.OriginalString)) $filePath = Join-Path -Path $downloadPath -ChildPath $filename # Write the response Stream to the to a file stream object $stream = [System.IO.File]::Create($filePath) try { $response.RawContentStream.WriteTo($stream) $downloaded += $stream.Length $stream.Close() } finally { if ($stream) { $stream.Dispose() } } "Saved: $filePath" } $i++ } "Total MB's of free ebook goodies downloaded: $([Math]::Round($downloaded / 1MB, 2))" } |
Speak Your Mind