Public/New-P1Tenant.ps1
function New-P1Tenant { <# .Synopsis Install a new PlannerOne tenant (service + web app). .Description Install a new PlannerOne tenant with the given parameters. One tenant should be: * One Windows service * One application pool * One web site * One web application Every name are set by convention from tenant name. You can force web application name for backward compatibility. Keep convention name if possible for easier maintenance. .Parameter Tenant The tenant name. .Parameter WebServicePort The port to be used by AppServer for REST API. .Parameter RemotingPort The port to be used by AppServer for Remoting API. .Parameter WebPort The customized port to be used by WebServer site. .Parameter WebAppName The customized name to use for web application. .Example # Install a PlannerOne tenant named P1Prod. New-P1Tenant -Tenant P1Prod #> [cmdletbinding()] param( [Parameter(Mandatory=$true)] [string] $Tenant, [int] $RemotingPort, [int] $WebServicePort, [int] $WebPort, [string] $WebAppName ) Process { if (Test-Tenant $Tenant) { Write-Warning "Tenant $Tenant already exist. Creation canceled." Write-Warning "Type Get-Help New-P1Tenant for more information." return } Write-Section "Creating tenant..." if ($RemotingPort -eq 0) { $RemotingPort = 9191 } if ($WebServicePort -eq 0) { $WebServicePort = 8731 } if ($WebPort -eq 0) { $WebPort = $DefaultWebPort } if (!$WebAppName) { $WebAppName = Get-WebAppNameFromTenant $Tenant } Write-Section "Registrating tenant..." Register-Tenant -Tenant $Tenant -RemotingPort $RemotingPort -WebServicePort $WebServicePort -WebAppName $WebAppName Write-OK "Registration done" New-P1ServerInstance -Tenant $Tenant New-P1WebApp -Tenant $Tenant -Port $WebPort -WebAppName $WebAppName Write-Warning "Run 'Set-P1Adapter' to configure ERP Adapter" Write-Warning "Run 'Start-P1Manager -Tenant $Tenant' to initialize your ERP environments" Write-OK "Tenant '$Tenant' created" } } |