TenantHandling/Get-NavContainerTenants.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 |
<#
.Synopsis Retrieve all Tenants in a multitenant Nav container .Description Get information about all tenants in the Nav container .Parameter containerName Name of the container from which you want to get the tenant information .Example Get-NavContainerTenants -containerName test #> function Get-NavContainerTenants { Param ( [Parameter(Mandatory=$false)] [string]$containerName = "navserver" ) $session = Get-NavContainerSession -containerName $containerName -silent Invoke-Command -Session $session -ScriptBlock { $customConfigFile = Join-Path (Get-Item "C:\Program Files\Microsoft Dynamics NAV\*\Service").FullName "CustomSettings.config" [xml]$customConfig = [System.IO.File]::ReadAllText($customConfigFile) if ($customConfig.SelectSingleNode("//appSettings/add[@key='Multitenant']").Value -ne "true") { throw "The NAV Container is not setup for multitenancy" } Get-NavTenant -ServerInstance NAV } } Export-ModuleMember -Function Get-NavContainerTenants |