UserHandling/Get-NavContainerNavUser.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
<#
 .Synopsis
  Get list of users from NAV/BC Container
 .Description
  Retrieve the list of user objects from a tenant in a NAV/BC Container
 .Parameter containerName
  Name of the container from which you want to get the users (default navserver)
 .Parameter tenant
  Name of tenant from which you want to get the users
 .Example
  Get-NavContainerNavUser
 .Example
  Get-NavContainerNavUser -containerName test -tenant mytenant
#>

function Get-NavContainerNavUser {
    Param (
        [Parameter(Mandatory=$false)]
        [string] $containerName = "navserver",
        [Parameter(Mandatory=$false)]
        [string] $tenant = "default"
    )

    PROCESS
    {
        Invoke-ScriptInNavContainer -containerName $containerName -ScriptBlock { param($tenant)
            Get-NavServerUser -ServerInstance $ServerInstance -tenant $tenant
        } -ArgumentList $tenant | Where-Object {$_ -isnot [System.String]}
    }
}
Set-Alias -Name Get-BCContainerBCUser -Value Get-NavContainerNavUser
Export-ModuleMember -Function Get-NavContainerNavUser -Alias Get-BCContainerBCUser