In Microsoft Dynamics NAV 2013 R2 managing (Create new, delete, rename and Copy) companies is done in a different way. In previous versions of NAV, we would manage companies in the classic client (which is now development environment).
In NAV 2013 R2 development environment, when we click on File, we do not see any option to manage companies like before!!
However, There are 2 ways in which we will be able to manage companies in Microsoft Dynamics NAV 2013 R2.
- Using the Windows client
- Using the PowerShell cmdlets
We’ll explore both the ways of managing companies in Microsoft Dynamics NAV 2013 R2.
In Microsoft Dynamics NAV 2013 R2 Windows Client, we will be able to see the list of companies and manage them under Departments–> Administration–> IT Administration –> General –> Companies as shown in the below image.
Using this window, we can create new companies with no data (New), Delete Existing Companies (Delete), Rename Companies (Edit List to rename) etc..
We can use Copy action button to copy all the data of selected company into a new company.
Once the new company is created, it will be listed in the same window as shown below:
We will be able to open the new company using the select company window in the windows client:
We can also manage companies using Windows PowerShell Cmdlets in the Microsoft Dynamics NAV 2013 R2 Administration Shell (installed with Microsoft Dynamics NAV 2013 R2).
When we open Microsoft Dynamics NAV 2013 R2 Administration Shell (on the Start menu, choose All Programs, and then choose Microsoft Dynamics NAV 2013 R2 Administration Shell. This opens a Windows PowerShell prompt), it lists NAV cmdlets which we can use as shown below. Company related commands like Copy-NAVCompany, Get-NAVCompany, New-NAVCompany, Remove-NAVCompany and Rename-NAVCompany are also listed here. We can run these commands for the respective jobs.
For example, we can get the existing companies in our database using the Get-NAVCompany command:
We can also use Windows PowerShell ISE (Integrated Scripting Environment) tool which is more advanced and user friendly to run the commands.
Windows PowerShell ISE 3.0 is installed by default with Windows 8 and Windows server 2012. In case of older OS, we can download and install PowerShell ISE from here
We need to open Windows PowerShell ISE as Administrator and the tool is shown in the following image.
To use and run NAV cmdlets in Windows PowerShell ISE, first we need to import the Windows PowerShell Script file (NavAdminTool.ps1) located in Service folder (By default: C:\Program Files\Microsoft Dynamics NAV\71\Service)
Write the following script to import the NavAdminTool file and run the command.
Import-Module ‘C:\Program Files\Microsoft Dynamics NAV\71\Service\NavAdminTool.ps1′
Once the command runs successfully, refresh the commands window (right side) and search for Company related commands. We will be able to see all the commands related to company management here.
To use a particular command in the commands window, click on it and enter the required parameters below.
For example: we can click on New-NAVCompany and enter required parameters below. We can choose to run the command directly from the commands window, Copy the whole command or insert the command in the PowerShell console.
In the following image, I copied the command, pasted it in the scripting window and ran it. This step created a new company (Cronus Test-2) in my database.
I can use Get-NAVCompany command to see the existing companies:
We will be able to use all of the company related commands in similar fashion in the Windows PowerShell ISE to manage companies easily.
We can explore more NAV related commands by searching in the commands windows as shown below:
To learn more about any of these commands use Get-Help <Command>.