Public/Get-P1Version.ps1

function Get-P1Version {
    <#
    .Synopsis
    Get the PlannerOne version for tenant.

    .Description
    Get the PlannerOne server version for tenant.

    .Parameter Tenant
    The tenant name.

    .Example
    # Get version of tenant Prod
    Get-P1Version 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-TenantInfo $Tenant
        if ($info -eq $null) {
            Write-Warning "No information registered for tenant $Tenant"
            return
        }

        $path = $info.Path
        $revisionPath = $path + "\revision.txt"
        if (!(Test-Path $revisionPath)) {
            Write-Warning "DEV - Trying to get SVN informations"
            $svnPath = $path + "\..\.."
            Invoke-Expression "svn info `"$svnPath`""
            return
        }

        Get-Content $revisionPath
    }
}