$containername = Read-Host "What's the container name?"
$dns = '8.8.8.8'
if (!$containername) {
Write-Host "Exiting script due to lack of input."
Exit
}
$version = Read-Host "Which version would you like to install? (2016/2017/2018/BC15)"
$image = 'mcr.microsoft.com/businesscentral/onprem:nl'
if ($version -notin '2016','2017','2018','BC15') {
Write-Host "No valid version has been chosen. Restart the script."
exit
}
$cu = Read-Host "Which CU version would you like to install? If empty, the latest will be installed. (Format: cuxx)"
if ($cu -notcontains 'cu','CU') {
Write-Host "No valid format has been used (for example CU20 or CU10. the latest version will be installed"
Clear-Variable cu
}
switch ($version)
{
2016 {$image = 'microsoft/dynamics-nav:2016-'}
2017 {$image = 'microsoft/dynamics-nav:2017-'}
2018 {$image = 'microsoft/dynamics-nav:2018-'}
BC15 {$image = 'mcr.microsoft.com/businesscentral/onprem:'}
}
if ($cu -eq $null) {
} else {
$image = $image + $cu + '-'
}
$locale = Read-Host "Which locale would you like to install? If left empty, w1 will be installed. (nl/de/gb/w1)"
if ($locale -notin 'nl','gb','de','w1') {
Write-Host "No valid locale has been chosen. Default: W1 has been set!"
$locale = 'w1'
}
switch ($locale)
{
nl {$image = $image + 'nl'}
de {$image = $image + 'de'}
gb {$image = $image + 'gb'}
w1 {$image = $image + 'w1'}
}
$auth = Read-Host "What type of authentication do you want? (NavUserPassword/UserPassword/Windows)"
if ($auth -notin 'Windows','UserPassword','Windows') {
Write-Host "No valid authentication has been chosen. Default: UserPassword has been set!"
$auth = 'NavUserPassword'
}
Write-Host "Summary of the installation:"
Write-Host "Server name: "$containername
Write-Host "Nav version: "$version
Write-Host "Locale: "$locale
Write-Host "Authentication: "$auth
Write-Host "Image to be installed/downloaded: " $image
Write-Host "Additional Parameters: " $additionalParameters
Write-Host "License file location: " $licenceadded
$confirm = Read-Host "Do you want to continue? (Y/N)"
if ($confirm -eq 'y') {
if ($version -eq 'BC15') {
New-BCContainer -accept_eula -updateHosts -containerName $containername -auth $auth -imageName $image -dns $dns -shortcuts DesktopFolder -alwaysPull -memoryLimit 4G
} else {
New-NavContainer -containerName $containername -imageName $image -auth $auth -accept_eula -accept_outdated -includeCSide -doNotExportObjectsToText -alwaysPull -shortcuts DesktopFolder -updateHosts -dns $dns -memoryLimit 4G
}
} else {
Write-Host "Script has been terminated."
}
docker container list -a
$containername = Read-Host "Which container do you want to remove?"
$confirmation = Read-Host "Are you sure you want to remove the container? (Y/N)" $containername
if ($confirmation -eq 'y') {
Remove-NavContainer -containerName $containername
Write-Host("Container " + $containername + " removed.")
} else {
Write-Host("No containers to remove.")
}
install-module navcontainerhelper -force
To run containers on Windows 10, you need the following:
One physical computer system running Windows 10 Professional or Enterprise with Anniversary Update (version 1607) or later.
Hyper-V should be enabled.
Starting with the Windows 10 October Update 2018, we no longer disallow users from running a Windows container in process-isolation mode on Windows 10 Enterprise or Professional for dev/test purposes. See the FAQ to learn more.
Windows Server Containers use Hyper-V isolation by default on Windows 10 in order to provide developers with the same kernel version and configuration that will be used in production. Learn more about Hyper-V isolation in the Concepts area of our docs.
Install Docker
The first step is to install Docker, which is required for working with Windows containers. Docker provides a standard runtime environment for containers, with a common API and command-line interface (CLI).
For more configuration details, see Docker Engine on Windows.
You can install Docker on Windows 10 Professional and Enterprise editions by using the following steps.
Download and install Docker Desktop, creating a free Docker account if you don't have one already. For more details, see the Docker documentation.
During installation, set the default container type to Windows containers. To switch after installation completes, you can use either the Docker item in the Windows system tray (as shown below), or the following command in a PowerShell prompt:
console
Kopiëren
& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon .
Docker system tray menu showing the "Switch to Windows containers" command.
$containername = Read-Host "Which container do you want to work with?"
if (!$containername) {
Write-Host "Exiting script due to lack of input."
Exit
}
$currentDateTime = Get-Date -Format "dd-MM-yy-HH-mm"
$path = 'C:\programdata\navcontainerhelper\temp\' + $containername
$destination = 'C:\Temp\' + $containername + '\' + $currentDateTime
$destination2 = $destination + '\FOB\'
$destination3 = $destination + '\TXT\'
Write-Host "Exporting files to: " + $destination
Export-NavContainerObjects -containerName $containername -objectsFolder $path -exportTo 'txt file'
Start-Sleep -Seconds 3
Copy-Item -Force -Recurse $path -Destination $destination3
Start-Sleep -Seconds 3
Export-NavContainerObjects -containerName $containername -objectsFolder $path -exportTo 'txt folder'
Start-Sleep -Seconds 3
Copy-Item -Force -Recurse $path -Destination $destination3
Start-Sleep -Seconds 3
Export-NavContainerObjects -containerName $containername -objectsFolder $path -exportTo 'fob file'
Start-Sleep -Seconds 3
Copy-Item -Force -Recurse $path -Destination $destination2
Start-Sleep -Seconds 3
Remove-Item $path -Force -Recurse
Invoke-Item -Path $destination
$containername = Read-Host "Which container do you want to work with?"
$managementCodeunit = 51000
$tag = Read-Host "What is the version tag (for example: NM / AGR/ SPA)"
$version = Read-Host "What is the version No.? (for example: 1.14)"
$filter = 'Version List=@*'+$tag+'*'
$currentDateTime = Get-Date -Format "dd-MM-yy"
$path = 'C:\programdata\navcontainerhelper\temp\' + $containername
$destination = 'C:\Releases\' + $currentDateTime + '\' + $tag + $version
$destination2 = $destination + '\FOB\'
$destination3 = $destination + '\TXT\'
$destination4 = $destination + '\MOD\'
Write-Host "Compiling objects with version:" + $tag+$version
Compile-ObjectsInNavContainer -containerName $containername -SynchronizeSchemaChanges Yes -ErrorAction Stop
Write-Host "Exporting objects.txt"
Export-NavContainerObjects -containerName $containername -objectsFolder $path -exportTo 'txt file' -filter $filter
Start-Sleep -Seconds 3
Copy-Item -Force -Recurse $path -Destination $destination3
Start-Sleep -Seconds 3
Write-Host "Exporting .txt per object"
Export-NavContainerObjects -containerName $containername -objectsFolder $path -exportTo 'txt folder' -filter $filter
Start-Sleep -Seconds 3
Copy-Item -Force -Recurse $path -Destination $destination3
Start-Sleep -Seconds 3
Write-Host "Exporting .fob"
Export-NavContainerObjects -containerName $containername -objectsFolder $path -exportTo 'fob file' -filter $filter
Start-Sleep -Seconds 3
Copy-Item -Force -Recurse $path -Destination $destination2
Start-Sleep -Seconds 3
Remove-Item $path -Force -Recurse
Write-Host "Exporting all modified objects"
Export-NavContainerObjects -containerName $containername -objectsFolder $path -exportTo 'fob file'
Start-Sleep -Seconds 3
Copy-Item -Force -Recurse $path -Destination $destination4
Start-Sleep -Seconds 3
Export-NavContainerObjects -containerName $containername -objectsFolder $path -exportTo 'txt file'
Start-Sleep -Seconds 3
Copy-Item -Force -Recurse $path -Destination $destination4
Remove-Item $path -Force -Recurse
Invoke-Item -Path $destination