Module/Administration/Get-BCSAppStatusForMultipleServerInstances.ps1

<#
.SYNOPSIS
    Get BC tenant licens to value
.DESCRIPTION
    Get BC tenant licens to value for all tenants on a BC serverInstance
 
.PARAMETER serverInstance
    Hashtable specifying Server Instance Name and Business Central Server
 
.EXAMPLE
 
.NOTES
    Author: Mathias Stjernfelt
    Website: http://www.brightcom.se
#>

function Get-BCSAppStatusForMultipleServerInstances {
    Param (
        [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)]
        [PSObject]$ServerInstances,
        [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)]
        [string]$userName,
        [Parameter(ValueFromPipelineByPropertyName, Mandatory = $true)]
        [SecureString]$password
    )
    begin {
        Install-Module BCSPowershellModule -Scope CurrentUser -Force
    }

    process {
        $instancesHash = [PSCustomObject]@();

        foreach ($serverInstance in $ServerInstances) {
            Write-Host "Fetching App Status from $($serverInstance.Name) on $($serverInstance.businessCentralServer)"
            $instancesHash += Get-BCSAppStatusForServerInstance -serverInstance $serverInstance.Name -businessCentralServer $serverInstance.businessCentralServer -userName $userName -password $password
        }

        $instancesHash    
    }
    end {
    }
}

Export-ModuleMember -Function Get-BCSAppStatusForMultipleServerInstances