Public/Start-P1.ps1

function Start-P1 {
    <#
    .Synopsis
    Start PlannerOne product.

    .Description
    Start PlannerOne product with web client.

    .Parameter Tenant
    The target tenant.

    .Example
    # Start PlannerOne for tenant named Prod.
    Start-P1 -Tenant Prod
    #>

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

        $info = Get-P1Tenant $Tenant
        $host = $info.WebHost
        $port = $info.SitePort
        $app = $info.WebApplicationName
        $url = "http://" + $host + ":" + $port + "/" + $app
        Write-Verbose "Opening $url"
        [Diagnostics.Process]::Start($url) | Out-Null
    }    
}