CompanyHandling/Get-CompanyInNavContainer.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
<#
 .Synopsis
  Get a list of companies in the NAV/BC Container
 .Description
  Create a session to a container and run Get-NavCompany
 .Parameter containerName
  Name of the container in which you want to get the companies
  .Parameter tenant
  Name of tenant you want to get the commpanies for in the container
 .Example
  Get-CompanyInNavContainer -containerName navserver
#>

function Get-CompanyInNavContainer {
    Param (
        [string] $containerName = "navserver",
        [string] $tenant = "default"
    )

    Invoke-ScriptInNavContainer -containerName $containerName -ScriptBlock { Param($tenant)
        Get-NavCompany -ServerInstance $ServerInstance -Tenant $tenant
    } -ArgumentList $tenant | Where-Object {$_ -isnot [System.String]}
}
Set-Alias -Name Get-CompanyInBCContainer -Value Get-CompanyInNavContainer
Export-ModuleMember -Function Get-CompanyInNavContainer -Alias Get-CompanyInBCContainer