Public/Set-P1NavConfiguration.ps1

function Set-P1NavConfiguration {
    <#
    .Synopsis
    Configuration of the Microsoft Dynamics NAV Adapter.
 
    .Description
    Configure the Microsoft Dynamics NAV Adapter for PlannerOne.
 
    .Parameter Tenant
    The tenant name.
 
    .Parameter Server
    The tenant Microsoft Dynamics NAV host server name.
     
    .Parameter SOAPPort
    The NAV Web service SOAP port.
     
    .Parameter AuthenticationMode
    The NAV authentication mode (Negotiate, NTLM, Digest, Basic).
     
    .Parameter SSL
    Does the NAV server use SSL.
     
    .Parameter ClientPort
    The port for Microst Dynamics NAV RTC client.
     
    .Parameter InstanceName
    The NAV server instance name.
     
    .Parameter ServiceDomain
    The PlannerOne technical account domain.
                     
    .Parameter ServiceLogin
    The PlannerOne technical account login.
                     
    .Parameter ServicePassword
    The PlannerOne technical account password.
                                                             
    .Example
    # Configure a NAV adapter
    Set-P1NavConfiguration -Tenant nodb -ServiceDomain ORTEMS -ServiceLogin PlannerOne -ServicePassword Planner1 -Server locahost -InstanceName DynamicsNAV90 -SOAPPort 9047
    #>

    [cmdletbinding()]
    param( 
        [string] $Tenant,
        [string] $Server,
        [int] $SOAPPort,
        [string] $AuthenticationMode,
        [bool] $SSL,
        [int] $ClientPort,
        [string] $InstanceName,
        [string] $ServiceDomain,
        [string] $ServiceLogin,
        [string] $ServicePassword
    )
    Process
    {
    Write-Section "Configuring NAV Adapter..."
        Set-NAVParameters $Tenant $Server $SOAPPort $AuthenticationMode $SSL $ClientPort $InstanceName $ServiceDomain $ServiceLogin $ServicePassword
        
        $serviceName = Get-ServiceNameFromTenant $Tenant
        
        Write-Output "Restarting PlannerOne service $serviceName..."
        Restart-Service -Name $serviceName
    Write-OK "Configuration done"
    }
}