AppHandling/Get-NavContainerAppInfo.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
<#
 .Synopsis
  Get Nav App Info from Nav container
 .Description
  Creates a session to the Nav container and runs the Nav CmdLet Get-NavAppInfo in the container
 .Parameter containerName
  Name of the container in which you want to enumerate apps (default navserver)
 .Parameter tenant
  Specifies the tenant from which you want to get the app info
 .Parameter tenantSpecificProperties
  Specifies whether you want to get the tenant specific app properties
 .Parameter symbolsOnly
  Specifies whether you only want apps, which are of packagetype SymbolsOnly (Specifying SymbolsOnly ignores the tenant parameter)
 .Example
  Get-NavContainerAppInfo -containerName test2
 .Example
  Get-NavContainerAppInfo -containerName test2 -tenant mytenant -tenantSpecificProperties
 .Example
  Get-NavContainerAppInfo -containerName test2 -symbolsOnly
#>

function Get-NavContainerAppInfo {
    Param(
        [string]$containerName = "navserver",
        [string]$tenant = "",
        [switch]$symbolsOnly,
        [switch]$tenantSpecificProperties
    )

    $args = @{ "ServerInstance" = "NAV" }

    if ($symbolsOnly) {
        $args += @{ "SymbolsOnly" = $true }
    } else {
        if ($tenantSpecificProperties) {
            $args += @{ "TenantSpecificProperties" = $true }
        }
        if ("$tenant" -eq "") {
            $tenant = "default"
        }
        $args += @{ "Tenant" = $tenant }
    }

    $session = Get-NavContainerSession -containerName $containerName
    Invoke-Command -Session $session -ScriptBlock { Param($inArgs)
        Get-NavAppInfo @inArgs
    } -ArgumentList $args
}
Export-ModuleMember -Function Get-NavContainerAppInfo