Determine the Packt Publishing Free eBook of the Day with PowerShell

First of all, let me state that I’m in no way affiliated with Packt Publishing other than being a customer. They offer a free eBook each day and that information is freely available on the Internet. Like any information on the web, it’s publicly available and you can read it with a web browser or with something like PowerShell.

As shown in the following example, a PowerShell one liner can be used to determine their free eBook of the day:


This requires PowerShell version 3 or higher and based on the way it’s written, it may not work if the format of their webpage is changed since it simply returns the first item on the webpage that uses a H2 html tag.

I’ve placed that one liner in my all users console host profile so I see what their free eBook of the day is when I open the PowerShell console. I typically only see this information once per day since I normally only open the PowerShell console once a day and leave it open until I shutdown my computer.


As you can see in the previous set of results, The Packt Publishing free learning eBook of the day for today (March 2, 2016) is: ‘SQL Server 2012 with PowerShell V3 Cookbook‘. It’s a book that I’ve previously purchased and read that’s written by Microsoft MVP Donabel Santos (sqlbelle) who is also a contributing author of a chapter in the PowerShell Deep Dives book which I also wrote a chapter in.

If you’re not familiar with the different PowerShell profiles such as the one that I referenced that’s applied to all users and only the PowerShell console host, see my blog article on “PowerShell $Profile: The six options and their precedence“.



  1. NolanC

    Hi Mike,

    Love the script. For your readers living behind a proxy server they can modify your script with an extra variable and modify the $Book script

    $proxy = [System.Net.WebRequest]::GetSystemWebProxy().GetProxy(“”) | select AbsoluteUri
    $Book = (Invoke-WebRequest -Proxy $proxy.AbsoluteUri -ProxyUseDefaultCredentials -Uri‘H2’)[0].InnerHTML.Trim()

  2. Jony Astorro

    You can also try this python script : )


Leave a Reply

%d bloggers like this: