Public/Get-P1AdapterStatus.ps1

function Get-P1AdapterStatus {
    <#
    .Synopsis
    Get the PlannerOne adapter health status.

    .Description
    Work only for NAV.
    Get the PlannerOne adapter status.
    Global status is the base status of the adapter. It is on error in case of global error like network.
    Environments are the status for all environments.
    Status is the computed status based on previous one. It is the one shown in manager.

    .Parameter Tenant
    The PlannerOne tenant.

    .Example
    # Get adapter status of Prod
    Get-P1AdapterStatus PROD
    #>

    [cmdletbinding()]
    param(
        [Parameter(Mandatory=$true)]
        [string] $Tenant
    )
    Process
    {
        Write-Section "Getting adapter status"
        if (!(Test-Tenant $Tenant)) {
            Write-Warning "Tenant $Tenant does not exist."
            Write-Warning "Operation canceled."
            return;
        }

        $TenantInfo = Get-P1Tenant $Tenant

        $wsPort = $TenantInfo.WebServicePort

        Get-AdapterStatus $wsPort
    }
}