Module/Administration/Get-BCSInstalledAppsPerTenant.ps1
<#
.SYNOPSIS .DESCRIPTION .EXAMPLE .NOTES Author: Mathias Stjernfelt Website: http://www.brightcom.se #> function Get-BCSInstalledAppsPerTenant { Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)] [string]$serverInstance ) begin {} process { Import-BCSDynamicsNavModules -ServerInstance $serverInstance if ($a) { $a.Clear() } $tenants = Get-NAVAppTenant -ServerInstance $ServerInstance | Select-Object -Property Id; $a = @(); foreach ($tenant in $tenants) { $apps = Get-NAVAppInfo -ServerInstance $ServerInstance -Tenant $tenant.Id -TenantSpecificProperties foreach ($app in $apps) { $item = New-Object PSObject $item | Add-Member -type NoteProperty -Name 'TenantId' -Value $tenant.Id $item | Add-Member -type NoteProperty -Name 'AppName' -Value $app.Name $item | Add-Member -type NoteProperty -Name 'AppPublisher' -Value $app.Publisher $item | Add-Member -type NoteProperty -Name 'AppVersion' -Value $app.Version $item | Add-Member -type NoteProperty -Name 'AppScope' -Value $app.Scope $item | Add-Member -type NoteProperty -Name 'AppIsInstalled' -Value $app.IsInstalled $item | Add-Member -type NoteProperty -Name 'AppIsPublished' -Value $app.IsPublished $item | Add-Member -type NoteProperty -Name 'AppSyncState' -Value $app.SyncState $item | Add-Member -type NoteProperty -Name 'AppId' -Value $app.AppId $a += $item } } $a } end { } } Export-ModuleMember -Function Get-BCSInstalledAppsPerTenant |