functions/setup/Start-BcSetup.ps1

function Start-BcSetup {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)]
        [int]$MajorVersion,
        [Parameter(Mandatory=$true)]
        [int]$MinorVersion,
        [Parameter(Mandatory=$true)]
        [string]$CountryCode,
        [Parameter(Mandatory=$false)]
        [string]$DvdRepositoryPath = (Join-Path $env:SystemDrive 'DVD\BC'),
        [switch]$NoService,
        [switch]$InstallWebClient,
        [switch]$AcceptTOS
    )

    $DvdPath = "$($DvdRepositoryPath)\$($MajorVersion)\$($MinorVersion)\$($CountryCode)"
    $MsiPath = "$($DvdPath)\ServiceTier\Microsoft Dynamics 365 Business Central Server.msi"

    $IsDvdReady = Test-Path $MsiPath -PathType Leaf

    if (-not $IsDvdReady)
    {
        $DvdZipPath = Get-BcDvd -MajorVersion $MajorVersion -MinorVersion $MinorVersion -CountryCode $CountryCode -DvdRepositoryPath $DvdRepositoryPath
        Expand-Archive -Path $DvdZipPath -DestinationPath $DvdPath 
    }

    if (-not $NoService)
        { Install-Bc -DvdPath $DvdPath -Component Service -AcceptTOS:$AcceptTOS }

    if ($InstallWebClient)
        { Install-Bc -DvdPath $DvdPath -Component WebClient -AcceptTOS:$AcceptTOS }
}