Public/New-bConnectApplicationInstallationData.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
Function New-bConnectApplicationInstallationData() {
    <#
        .Synopsis
            Creates a new InstallationData for Applications.
            Empty or filled with given information.
        .Parameter Command
            Installation command
        .Parameter Parameter
            Parameter for installation command
        .Parameter ResponseFile
            ResponseFile for the installation
        .Parameter EngineFile
            File for installation engine (Engine will be set automatically based on EngineFile; only bDS supported in this PS module)
        .Parameter Options
            InstallApplicationOption object
        .Parameter UserSettings
            InstallUserSettings object
        .Outputs
            InstallationData (see bConnect documentation for more details)
    #>


    [OutputType("System.Management.Automations.PSObject")]
    Param(
        [string]$Command,
        [string]$Parameter,
        [string]$ResponseFile,
        [string]$EngineFile,
        [PSCustomObject]$Options,
        [PSCustomObject]$UserSettings
    )

    $_new_installationData = @{}

    If(![string]::IsNullOrEmpty($Command)) {
        $_new_installationData += @{ Command = $Command }
    }

    If(![string]::IsNullOrEmpty($Parameter)) {
        $_new_installationData += @{ Parameter = $Parameter }
    }

    If(![string]::IsNullOrEmpty($ResponseFile)) {
        $_new_installationData += @{ ResponseFile = $ResponseFile }
    }

    If(![string]::IsNullOrEmpty($EngineFile)) {
        $_new_installationData += @{ Engine = "baramundi Deploy Script"; EngineFile = $EngineFile }
    }

    If($Options) {
        $_new_installationData += @{ Options = $Options }
    }

    If($UserSettings) {
        $_new_installationData += @{ UserSettings = $UserSettings }
    }

    return $_new_installationData
}