Download all free ebooks from Microsoft using Powershell


If you’d like to conveniently download all the ebooks Eric Ligman has been kind enough to share out… You can run this in PowerShell 3.0 or higher (It was tested in Windows 10 – Powershell 5 but should work in earlier versions…. if I get rid of Invoke –WebRequest…. all versions)

 

# Create Web client object

$Wc=New-object system.net.webclient

$link=’https://blogs.msdn.microsoft.com/mssmallbiz/2016/07/10/free-thats-right-im-giving-away-millions-of-free-microsoft-ebooks-again-including-windows-10-office-365-office-2016-power-bi-azure-windows-8-1-office-2013-sharepoint-2016-sha/’

# Download the source page

$result=Invoke-WebRequest -Uri $link

# Get a list of the URLS of the books and resources with Eric’s short name in there

$URIList=$result.links | where { $_.OuterHTML -match ‘ligman.me’ }

Foreach ($URI in $URIList)
{
# Get the Download link

$DownloadLink=$URI.href

# Find the original filename (Thanks to Dr. Tobias Weltner’s tip on this!)

$Response=[system.net.webrequest]::Create($DownloadLink).getresponse()
# Scoop out the file name

$filename=($Response.ResponseURI.AbsolutePath.split(‘/’)[-1])
# Download the goodies

$wc.downloadfile($downloadlink,$filename)
#
$Response.close()
}

 

This will take a while and it’s NOT going to show a progress bar (you can play with that) but you don’t need to sit and watch.   Warning… this may hit your bandwidth so try to do it on your personal account…. not the company internet

Follow

Get every new post delivered to your Inbox.

Join 3,890 other followers