Sample/P1SampleScript.ps1

# -----------------------------------------------------------------------------
# Install PlannerOne Demo (all-in-one script)
# This sample script is provided for demonstration
# You can adapt the following variables to your context
# -----------------------------------------------------------------------------
$P1Tenant = "Demo"
$NAVInstance = "NAV"
# Technical account (must exist in $NAVInstance database)
$UserDomain = $env:USERDOMAIN
$UserLogin = $env:USERNAME 
$UserPassword = "<EnterPassword>"

$features = Test-P1Prerequisites

$missingFeatures = ($features | Where-Object InstallState -ne Installed)

if ($missingFeatures.Count -eq 0) {
    # Create new tenant
    New-P1Tenant $P1Tenant

    # Configure adapter of tenant
    Set-P1Adapter -Tenant $P1Tenant -ERP NAV -InstanceName $NAVInstance -ServiceDomain $UserDomain -ServiceLogin $UserLogin -ServicePassword $UserPassword -AutoPort

    # Get environments of tenant and save thel in a variable
    $envList = Get-P1Environments -Tenant $P1Tenant -Product Production

    # Initialize all environments in list
    Initialize-P1Environments -Tenant $P1Tenant -Environments $envList

    #Remove-P1Tenant Demo
} else {
    $missingFeatures
}

# To show prerequisites validation, run Uninstall-WindowsFeature 'NET-WCF-HTTP-Activation45' before running this script
# To show NAV instance validation, set "Services Default Time Zone" to UTC or set "Enable SOAP Services" to false before running this script