Sample Output

Download Helper for Dynamics 365 Business Central

Blogging, Business Central, Development, PowerShell , ,

We all know these situations: you have a simple requirement and wonder anyway why you can’t find an easy-to-use solution to solve it. That’s why I created a little PowerShell-module which I’ll describe here.

Requirement

I needed a simple way to retrieve the download link for a Dynamics 365 Business Central DVD ZIP file from Microsoft (like these here). I would have preferred an easy-to-use approach (similar to specifying mcr.microsoft.com/businesscentral/onprem:cu3-nl for a Docker image).

Maybe I was to impatient during my search or looked for the wrong keywords. But anyway I couldn’t find anything. That’s why I started with a little script, which became a slightly bigger script, which ultimately became the module I’m writing about here.

Solution

Well, the solution is quite easy now 😊 Just install the module D365BCDownloadHelper in PowerShell like this:

Install-Module D365BCDownloadHelper

and then import it like this:

Install-Module D365BCDownloadHelper

and you’re good to go 👍

The available CmdLets are the following:

Get-BusinessCentralDownloadURL: Returns the URI (string) for the desired version

  • Parameters
    • Version (integer): defaults to “14”; possible values 13, 14, 15
    • CumulativeUpdate (string): defaults to “CU01”
    • Language (string): defaults to “W1”; values like Microsoft lists them (AT,AU,BE,CH,CZ,DE,DK,…)
  • Output
    • URI (string): the download link for the ZIP file

Receive-BusinessCentralDVD: Downloads the ZIP file for the desired version

  • Parameters
    • Version (integer): defaults to “14”; possible values 13, 14, 15
    • CumulativeUpdate (string): defaults to “CU01”
    • Language (string): defaults to “W1”; values like Microsoft lists them (AT,AU,BE,CH,CZ,DE,DK,…)
    • DownloadDirectory (string): defaults to “C:\Install”
  • Output
    • URI (string): the FullPath for the downloaded file

Expand-BusinessCentralDVD: Extracts the ZIP file

  • Parameters
    • ZipFilename (string): FullPath of the ZIP file
    • TargetDirectoryParent (string): e.g. “C:\Install”
    • TargetDirectoryName (string): defaults to “DVD”
  • Output
    • none
  • Remarks: Some archives contain another ZIP file; this CmdLet will check if that’s the case and also extract the inner ZIP (actually if that’s the case, this one will be the only content remaining, the content from the parent ZIP will be deleted)

Get-ReceiveAndExpandBusinessCentralDVD: I think you can guess 😅 Not sure if I like the naming though 😉

  • Parameters
    • Version (integer): defaults to “14”; possible values 13, 14, 15
    • CumulativeUpdate (string): defaults to “CU01”
    • Language (string): defaults to “W1”; values like Microsoft lists them (AT,AU,BE,CH,CZ,DE,DK,…)
    • DownloadDirectory (string): defaults to “C:\Install”
    • TargetDirectoryParent (string): e.g. “C:\Install”
    • TargetDirectoryName (string): defaults to “DVD”
  • Output
    • none

Remarks or: How does it work internally

Well, maybe it’s a somewhat naive approach, but it is how it is and it’s described here:

  • Create a search query string based on the given information (e.g. Get-BusinessCentralDownloadURL -Version 14 -CumulativeUpdate "CU01" -Language "W1" will create the query CU 01 Dynamics 365 BC Spring 2019 Update On Premise.zip site:microsoft.com)
  • Do a Google-search with the generated query string (using Invoke-WebRequest)
  • Find a link to https://www.microsoft.com/en-us/download/ in the results
  • Get the download page and find the URL for the specific ZIP file on it

Feedback

I tested it (manually) with a couple of different parameters and it worked out in these cases. If you know a better, more robust, approach I’m happy when you leave me a comment here (or a Pull Request on GitHub). Of course I’m also happy about any other feedback 😊

Cheers, Simon

5 thoughts on “Download Helper for Dynamics 365 Business Central

  1. Hi,

    Thanks for this module, seems to be helpful. Well done.

    When I test “Get-ReceiveAndExpandBusinessCentralDVD” but Swedish version, it seems that language parameter is not considered in the functionality. I guess it could be for other countries as well.

    I would appreciate if you can check this and let us know do we need to update the module.

    Many thanks in advance.

    1. Hi mbaic,
      thanks for your comment! You were right, there was a problem. I used the case-insensitive “-match” instead of the case-sensitive “-cmatch” when looking for the Country-code in the file name (e.g. SE*.zip would also match “Update 15.1 Dynamics 365 Business Central 2019 Release Wave 2 W1.zip” because of the “se” in “Release“).

      Fixed it and updated the module. Just run “Update-Module” for it and you should be fine 🙂

      Thanks for your input. If you find further problems, feel free to comment here or create an Issue on Github.

      Cheers,
      Simon

Leave a Reply

Your email address will not be published.