Private/Get-bConnectVersion.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Function Get-bConnectVersion() {
    <#
        .Synopis
            Checks for supported bConnect version and returns the version (e.g. "v1.0").
    #>


    Param (
        [switch]$bMSVersion
    )

    $_info = Get-bConnectInfo

    If($_info) {
        $_bcVersion = "v$($_info.bConnectVersion)"
        $_bmsVersion = $_info.bMSVersion

        switch -Wildcard ($_bmsVersion) {
            "14.0.*" {
                Write-Warning "DEPRECATED! bConnect 2014R1"
            }

            "14.2.*" {
                Write-Warning "DEPRECATED! bConnect 2014R2"
            }

            "15.*" {
                Write-Verbose "DEPRECATED! bConnect 2015R1 or newer"
            }

            "16.*" {
                Write-Verbose "DEPRECATED! bConnect 2016R1 or newer"
            }

            "17.*" {
                Write-Verbose "DEPRECATED! bConnect 2017R1 or newer"
            }

            "18.*" {
                Write-Verbose "bConnect 2018R1 or newer"
            }

            "19.*" {
                Write-Verbose "bConnect 2019R1 or newer"
            }

            "20.*" {
                Write-Verbose "bConnect 2020R1 or newer"
            }

            default {
                Write-Warning "NOT SUPPORTED! Unknown bConnect Version -> Fallback to $($script:_bConnectFallbackVersion)"
                $_bcVersion = $script:_bConnectFallbackVersion
            }
        }

        If($bMSVersion) {
            return $_bmsVersion
        } else {
            return $_bcVersion
        }
    }
}