Pages

22 September 2014

Biggest Free E-Book collection online, and download them all with Powershell

I came across this blog: http://blogs.msdn.com/b/mssmallbiz

It lists almost 300 free e-books:

Windows 8.1
Windows 8 
Windows 7 
Office 2013
Office 365
Office 2010
SharePoint 2013 
Dynamics CRM
PowerShell
Exchange Server
Lync 2013
System Center
Azure 
Cloud
SQL Server

and much more.
Nice to have right?
But since you have to download them one by one, i found this script in the comments (Thanks Todd) and it works like a charm.

First download the MSFTEbooks.txt file from here
Then paste the below Powershell script directly in Powershell or run it from a ps1 file.
Edit your file locations to your corresponding folder locations.

Requires Powershell v3.0:

$booklist = Get-Content "D:\_DATA\Scripts\MSFTEbooks.txt"

$destination = "D:\_DATA\Downloads\E-Books"

foreach ($url in $booklist){

   if ($url.StartsWith("http")){
       $result = Invoke-WebRequest -Uri $url -outfile $destination\temp.tmp -PassThru
       if ($result.statuscode -eq "200"){
           $filename = join-path $destination (Split-Path -leaf ($result.BaseResponse.ResponseUri))
           Write-Host $filename
           Rename-Item $destination\temp.tmp $filename
       }
   }
}

While downloading it looks like this:



No comments:

Post a Comment