Public/New-bConnectApplicationDependency.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
Function New-bConnectApplicationDependency() {
    <#
        .Synopsis
            Creates a new Dependency for Applications.
            Empty or filled with given information.
        .Parameter DependencyId
            Guid of Application to use in Dependency
        .Parameter DependencyAppName
            Name of Application to use in Dependency
        .Parameter DependencyType
            Parameter with DependencyType
        .Parameter ValidForOS
            Parameter with ValidForOS
        .Outputs
            Dependency entry (see bConnect documentation for more details)
    #>


    [OutputType("System.Management.Automations.PSObject")]
    Param(
        [Parameter(Mandatory=$true)][string]$DependencyId,
        [Parameter(Mandatory=$true)][string]$DependencyAppName,
        [Parameter(Mandatory=$true)][ValidateSet("InstallBeforeIfNotInstalled","AlwaysInstallAfterwards","AlwaysInstallBefore","DeinstallBeforeIfInstalled","ErrorIfNotInstalled","ErrorIfInstalled",ignoreCase=$true)][string]$DependencyType,
        [Parameter(Mandatory=$true)][ValidateSet("NT4","Windows2000","WindowsXP","WindowsServer2003","WindowsVista","WindowsServer2008","Windows7","WindowsServer2008R2","WindowsXP_x64","WindowsServer2003_x64","WindowsVista_x64","WindowsServer2008_x64","Windows7_x64","WindowsServer2008R2_x64","Windows8","WindowsServer2012","Windows8_x64","WindowsServer2012_x64","Windows10","Windows10_x64","WindowsServer2016_x64","WindowsServer2019_x64",ignoreCase=$true)][array]$ValidForOS
    )

    $_new_Dependency = @{
        DependencyId = $DependencyId;
        DependencyAppName = $DependencyAppName;
        DependencyType = $DependencyType;
        ValidForOS = $ValidForOS
    }
<# If(![string]::IsNullOrEmpty($DependencyId)) {
        $_new_Dependency += @{ DependencyId = $DependencyId }
    }
 
    If(![string]::IsNullOrEmpty($DependencyAppName)) {
        $_new_Dependency += @{ DependencyAppName = $DependencyAppName }
    }
 
    If(![string]::IsNullOrEmpty($DependencyType)) {
        $_new_Dependency += @{ DependencyType = $DependencyType }
    }
 
    If(![string]::IsNullOrEmpty($ValidForOS)) {
        $_new_Dependency += @{ ValidForOS = $ValidForOS } #>


    return $_new_Dependency
}