Module/Administration/Get-BCSLicensedToPerServerInstance.ps1
<#
.SYNOPSIS Get BC tenant licens to value .DESCRIPTION Get BC tenant licens to value for all tenants on a BC serverInstance .EXAMPLE .NOTES Author: Mathias Stjernfelt Website: http://www.brightcom.se #> function Get-BCSLicensedToPerServerInstance { Param ( [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)] [string]$ServerInstance ) begin {} process { Import-BCSDynamicsNavModules -ServerInstance $serverInstance $tenants = Get-NAVAppTenant -ServerInstance $serverInstance $appsHash = [PSCustomObject]@(); foreach ($tenant in $tenants) { $licensedTo = ''; $license = Export-NAVServerLicenseInformation -ServerInstance $serverInstance -Tenant $tenant.Id $licensedTo = ""; $expires = ""; ForEach ($line in $($license -split "`r`n")) { if ($line -match "Licensed to") { $licensedTo = $Line.Substring(26, $line.Length - 26) } if ($line -match "Expires") { $expires = $Line.Substring(26, $line.Length - 26); } } $item = New-Object PSObject $item | Add-Member -type NoteProperty -Name 'tenantId' -Value $tenant.Id; $item | Add-Member -type NoteProperty -Name 'LicensedTo' -Value $licensedTo; $item | Add-Member -type NoteProperty -Name 'Expires' -Value $expires; $appsHash += $item; } $appsHash } end { } } Export-ModuleMember -Function Get-BCSLicensedToPerServerInstance |