functions/setup/Get-BcDvdUrl.ps1

function Get-BcDvdUrl {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)]
        [int]$MajorVersion,
        [Parameter(Mandatory=$true)]
        [int]$MinorVersion,
        [Parameter(Mandatory=$true)]
        [ValidateSet('AT', 'AU', 'BE', 'CA', 'CH', 'CZ', 'DE', 'DK', 'ES', 'FI', 'FR', 'GB', 'IN', 'IS', 'IT', 'MX', 'NL', 'NO', 'NZ', 'RU', 'SE', 'US', 'W1')]
        [string]$CountryCode
    )

    $CommonBaseUrl = 'https://download.microsoft.com/download'
    $DvdPath = ''
    
    switch ($MajorVersion) {
        24 { 
            switch ($MinorVersion) {
                0 { $DvdPath = "/5/6/6/566B8516-4B4E-4DBE-BCDC-40B93F716C27/Dynamics.365.BC.Spring2019.29537.$($CountryCode).DVD.zip" }
                1 { $DvdPath = "/4/b/6/4b6b1e0c-9650-4512-b91a-14fe4ea5903e/Release/Dynamics.365.BC.19498.$($CountryCode).DVD.zip" }
                2 { $DvdPath = "/e/d/5/ed52c675-07ab-4de4-a8fa-1e3a750151bb/Release/Dynamics.365.BC.20424.$($CountryCode).DVD.zip" }
                default { Write-Debug "BC $($MajorVersion).$($MinorVersion) DVD URL unknown" }
            }
        }
        23 {
            switch ($MinorVersion) {
                0 { $DvdPath = "/3/e/7/3e71083e-6cd6-4598-a6bb-5c602b74aec3/Release/Dynamics.365.BC.12841.$($CountryCode).DVD.zip" }
                1 { $DvdPath = "/f/c/4/fc43480b-196c-4224-a10d-9a1f1a67b5c4/Release/Dynamics.365.BC.13812.$($CountryCode).DVD.zip" }
                2 { $DvdPath = "/a/8/5/a85df6d6-10d0-41ad-83d8-b90a1a180fa8/Release/Dynamics.365.BC.14562.$($CountryCode).DVD.zip" }
                3 { $DvdPath = "/0/c/d/0cdf60b6-edff-43d8-8f0f-203b74f84278/Release/Dynamics.365.BC.15024.$($CountryCode).DVD.zip" }
                4 { $DvdPath = "/2/e/d/2ed24f6d-5ba2-436e-9f32-f73c85906fd4/Release/Dynamics.365.BC.15715.$($CountryCode).DVD.zip" }
                5 { $DvdPath = "/1/4/0/14021cbe-9768-49b0-8717-554c4399dba2/Release/Dynamics.365.BC.16757.$($CountryCode).DVD.zip" }
                6 { $DvdPath = "/7/0/4/704a1a40-837b-4e27-82b3-c86890db01f1/Release/Dynamics.365.BC.18013.$($CountryCode).DVD.zip" }
                7 { $DvdPath = "/9/a/6/9a6c87ab-99c3-4814-97df-8983f11d450e/Release/Dynamics.365.BC.19495.$($CountryCode).DVD.zip" }
                8 { $DvdPath = "/4/d/e/4deb747d-19f0-4b8a-8e12-4466fa674449/Release/Dynamics.365.BC.20231.$($CountryCode).DVD.zip" }
                default { Write-Debug "BC $($MajorVersion).$($MinorVersion) DVD URL unknown" }
            }
        }
        22 { 
            switch ($MinorVersion) {
                0 { $DvdPath = "/8/9/8/898b7baa-9512-49a0-b68f-29bab2eb1182/Release/Dynamics.365.BC.55195.$($CountryCode).DVD.zip" }
                1 { $DvdPath = "/3/3/7/3371322f-97a0-4bad-8ebe-44504ebb4de1/Release/Dynamics.365.BC.56216.$($CountryCode).DVD.zip" }
                2 { $DvdPath = "/6/b/d/6bdd77ff-d583-4803-bd96-9f91913fcde3/Release/Dynamics.365.BC.57617.$($CountryCode).DVD.zip" }
                3 { $DvdPath = "/0/2/6/02619ccb-3b4b-4058-a6ac-e06452a02419/Release/Dynamics.365.BC.58453.$($CountryCode).DVD.zip" }
                4 { Write-Debug "BC $($MajorVersion).$($MinorVersion) DVD download has been withdrawn" }
                5 { $DvdPath = "/a/6/1/a614457e-30b0-47fa-8cbf-17f8ec49aa8d/Release/Dynamics.365.BC.60134.$($CountryCode).DVD.zip" }
                6 { $DvdPath = "/b/a/f/bafd9baf-1628-4e7e-a3e0-e9280471a9e8/Release/Dynamics.365.BC.60909.$($CountryCode).DVD.zip" }
                7 { $DvdPath = "/e/9/6/e964cb3d-117d-42a4-8cf3-d581150ea401/Release/Dynamics.365.BC.61690.$($CountryCode).DVD.zip" }
                8 { $DvdPath = "/0/2/6/02673045-139f-44b4-a21e-41bb2913f422/Release/Dynamics.365.BC.62286.$($CountryCode).DVD.zip" }
                9 { $DvdPath = "/8/b/9/8b9112de-2100-40c7-90da-515b480d6df0/Release/Dynamics.365.BC.62830.$($CountryCode).DVD.zip" }
                10 { Write-Debug "BC $($MajorVersion).$($MinorVersion) DVD download has been withdrawn" }
                11 { $DvdPath = "/a/c/0/ac0ee833-087a-445d-9dca-8035b8486d3f/Release/Dynamics.365.BC.63679.$($CountryCode).DVD.zip" }
                12 { $DvdPath = "/c/9/c/c9c020a9-d495-40a9-8c84-488d9da7db14/Release/Dynamics.365.BC.64167.$($CountryCode).DVD.zip" }
                13 { $DvdPath = "/0/1/e/01e0bcfb-4e52-4966-88d6-d4f93aa5d0ed/Release/Dynamics.365.BC.64410.$($CountryCode).DVD.zip" }
                14 { $DvdPath = "/2/3/5/235190fe-a52a-4441-9832-35734cbf54b8/Release/Dynamics.365.BC.64503.$($CountryCode).DVD.zip" }
                default { Write-Debug "BC $($MajorVersion).$($MinorVersion) DVD URL unknown" }
            }
        }
    }

    if ($DvdPath -ne '')
    {
        Write-Output "$($CommonBaseUrl)$($DvdPath)"
    } else {
        Write-Error "BC $($MajorVersion).$($MinorVersion) download not available (withdrawn or unknown)"
    }
}