Misc/Get-NavVersionFromVersionInfo.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<#
 .Synopsis
  Get NAV Version based on version info
 .Description
  Return NAV Version (like 2017, 2013r2 etc.) based on version number
 .Parameter versionInfo
  Version Info like (11.0.45332.0)
 .Example
  $mynav = "NAV $(Get-MavVersionFromVersionInfo -versionInfo $version) - build $version"
#>

function Get-NavVersionFromVersionInfo {
    Param (
        [Parameter(Mandatory=$true)]
        [string] $versionInfo
    )

    $versionInfoArr = $versionInfo.Split(".")
    $verno = ($versionInfoArr[0]+$versionInfoArr[1])

    $versions  = @{
        "70"  = "2013"
        "71"  = "2013r2"
        "80"  = "2015"
        "90"  = "2016"
        "100" = "2017"
        "110" = "2018"
    }

    return $versions[$verno]
}
Export-ModuleMember -Function Get-NavVersionFromVersionInfo