Public/Start-P1Tenant.ps1

function Start-P1Tenant {
    <#
    .Synopsis
    Start a PlannerOne tenant

    .Description
    Start a PlannerOne tenant by restarting web application and service.

    .Parameter Tenant
    The target tenant.
#>

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

        $info = Get-P1Tenant $Tenant
        $webApp = Get-P1WebApplication $Tenant
        if ($webApp -eq $null) {
                Write-KO "Cannot find the web application for tenant $Tenant"
                return
        }
        
        Start-P1ServiceInternal $info
        Start-P1WebInternal $webApp

        Write-OK "Tenant $Tenant started"
    }
}