Thanks for this.

In case anyone is curious, there are about 360 books and they consume about 3.5 
GB of disk. However, in some cases there are duplicates (i.e., the same book in 
3 formats: PDF, MOBI, and EPUB).

I found the PowerShell script provided to be a bit unforgiving of web errors. 
So, I enhanced it a bit. Here is my updated script:

###############################################################
# Eric Ligmans Amazing Free Microsoft eBook Giveaway
# 
https://blogs.msdn.microsoft.com/mssmallbiz/2017/07/11/largest-free-microsoft-ebook-giveaway-im-giving-away-millions-of-free-microsoft-ebooks-again-including-windows-10-office-365-office-2016-power-bi-azure-windows-8-1-office-2013-sharepo/
# Link to download list of eBooks
# http://ligman.me/2sZVmcG
# Thanks David Crosby for the template 
(https://social.technet.microsoft.com/profile/david%20crosby/)
###############################################################
$dest = "C:\Downloads\ebooks"

if( -not ( Test-Path $dest ) )
{
               New-Item -Path $dest -ItemType Directory
}

# Download the source list of books
$downLoadList = "http://ligman.me/2sZVmcG";
$bookList = Invoke-WebRequest $downLoadList

# Convert the list to an array
[string[]]$books = ""
$books = $bookList.Content.Split("`n")
# Remove the first line - it's not a book
# $books = $books[1..($books.Length -1)]
"retrieved a list of $( $books.Length ) books"
# $books # Here's the list

# Download the books
foreach ($book in $books)
{
               if( $book -and $book.Length -gt 0 -and $book.SubString( 0, 7 ) 
-eq 'http://' )
               {
               }
               else
               {
                              ".... skipping, line not book '$book'"
                              continue
               }

               try
               {
                              $hdr = Invoke-WebRequest $book -Method Head
               }
               catch
               {
                              ".... error retrieving header for $book"
                              continue
               }
               $title = $hdr.BaseResponse.ResponseUri.Segments[-1]
               $title = [uri]::UnescapeDataString($title)
               $saveTo = Join-Path $dest $title
               if( Test-Path $saveTo )
               {
                              "skipping... $saveTo"
               }
               else
               {
                              try
                              {
                                             Invoke-WebRequest $book -OutFile 
$saveTo
                              }
                              catch
                              {
                                             ".... error retrieving $saveTo 
($book)"
                              }
               }
}

From: [email protected] [mailto:[email protected]] On 
Behalf Of Fut Dey
Sent: Thursday, July 13, 2017 12:33 PM
To: [email protected]
Subject: [NTSysADM] Free eBooks for those MicroSoft Products


https://blogs.msdn.microsoft.com/mssmallbiz/2017/07/11/largest-free-microsoft-ebook-giveaway-im-giving-away-millions-of-free-microsoft-ebooks-again-including-windows-10-office-365-office-2016-power-bi-azure-windows-8-1-office-2013-sharepo/
Largest FREE Microsoft eBook Giveaway! I'm Giving Away 
...<https://blogs.msdn.microsoft.com/mssmallbiz/2017/07/11/largest-free-microsoft-ebook-giveaway-im-giving-away-millions-of-free-microsoft-ebooks-again-including-windows-10-office-365-office-2016-power-bi-azure-windows-8-1-office-2013-sharepo/>
blogs.msdn.microsoft.com
It's that time of year again, and today I am kicking off my annual FREE 
MICROSOFT EBOOK GIVEAWAY extravaganza! And this time, I'm posting MORE FREE ...

Regards,

Fut

Reply via email to