Sample Windows PowerShell Scripts for Microsoft Dynamics NAV

The Dynamics NAV product media includes a folder that has examples of how you can use the Dynamics NAV Windows PowerShell cmdlets to upgrade, deploy, and maintain your Dynamics NAV solution.

Dynamics NAV Sample Scripts

The sample Windows PowerShell scripts are available in the WindowsPowerShellScripts folder on the Dynamics NAV product media.

You can copy the folder to your computer and use the scripts as a starting point for managing your own solution. Depending on your solution, you can then add the sample Windows PowerShell module into the Microsoft Dynamics NAV Administration Shell or Microsoft Dynamics NAV Development Shell and then run the scripts.

The current version of Dynamics NAV includes the following sample modules.

Parent folder Module name Description
ApplicationMergeUtilities Contains sample scripts that illustrate different ways of using Windows PowerShell cmdlets to merge and modify application objects. The sample scripts use the Microsoft.Dynamics.Nav.Model.Tools.psd1 module, which you must import first.
Cloud HowTo Contains sample scripts and files for deploying a fully functional end-to-end Dynamics NAV solution on Microsoft Azure virtual machines. For more information, see For more information, see Deploying Microsoft Dynamics NAV Using the Example Scripts
NAVAdministration Illustrates how Windows PowerShell can be used to automate the provisioning and management of Dynamics NAV installations on a virtual machine (VM).
NAVRemoteAdministration Illustrates how Windows PowerShell can be used to automate the provisioning and management of Dynamics NAV installations on Azure VMs.
NAVRemoteAdministrationSamples Provides examples of a fully automated deployment of Dynamics NAV on Azure.
Multitenancy NAVMultitenancySamples Illustrates how you can automate the steps that are required to migrate to a multitenant deployment architecture.

For more information, see Migrating to Multitenancy.
Upgrade NAVUpgradeModule Illustrates how you can automate the upgrade of a Microsoft Dynamics NAV 2013 database to Microsoft Dynamics NAV 2018.

For more information, see Upgrading to Microsoft Dynamics NAV 2017.

Running the Sample Scripts

The sample scripts are designed to be run from the context of the Windows PowerShell module that is part of each collection of sample scripts. For example, to run the scripts for upgrading to Dynamics NAV, import the NAVUpgradeSamples.psm1 module into the Microsoft Dynamics NAV Administration Shell. Similarly, to run the sample scripts for merging application objects, open the HowTo-Start-Import-NAV-Module.ps1 script in the Windows PowerShell IDE, navigate the command prompt to the folder where you placed the samples, and then run the script.

For more information, see Getting Started with Windows PowerShell in the TechNet Library.

See Also

Administration
Deployment
Comparing and Merging Application Object Source Files
Upgrading to Microsoft Dynamics NAV 2017
Deploying and Managing Microsoft Dynamics NAV on Microsoft Azure