Categories
Dynamics NAV HOW TO Microsoft

HOW TO create NAV Instances with multiple builds in the same machine

The concepts described in this post are applicable to different versions/builds, for the examples I will use an installation of NAV 2013 R2 (7.1.35473) and I will create one or more instances also for the build 7.1.36703 (Cumulative Update 7 – May 2014) in the same server.

HOW TO create NAV Instances with multiple builds in the same machine?

We have to distinguish two different operations:

  1. Creation of the first instance for a different build
  2. Add more instances for this build

HOW TO create the first instance for a different build?

Prerequisites:

  • NAV 2013 R2 (7.1.35473) installed
  • Cumulative Update package downloaded

After you installed NAV 2013 R2 Server side’s files will be inside the following path:

C:\Program Files\Microsoft Dynamics NAV\71\

Copy the folder 71 in a new folder 71 – Build 36703

C:\Program Files\Microsoft Dynamics NAV\71 - Build 36703\

Copy and replace all files from the NST folder, in the Cumulative Update package, to the Service folder in the following path:

C:\Program Files\Microsoft Dynamics NAV\71 - Build 36703\Service\

Run Microsoft Dynamics NAV 2013 R2 Administration Shell and execute the following PowerShell CmdLet:

New-Service 'MicrosoftDynamicsNAVServer$NewInstanceName' -BinaryPathName '"C:\Program Files\Microsoft Dynamics NAV\71 - Build 36703\Service\Microsoft.Dynamics.Nav.Server.exe" $NewInstanceName /config "C:\Program Files\Microsoft Dynamics NAV\71 - Build 36703\Service\Microsoft.Dynamics.NAV.Server.exe.config"' -DependsOn 'HTTP' -Description 'Service handling requests to Microsoft Dynamics NAV application.' -DisplayName 'Microsoft Dynamics NAV Server [NewInstanceName]' -StartupType Manual

Note: you can replace NewInstanceName with your preferred name (there are 3 references) or use another name for the folder “71 – Build 36703” (there are 2 references)

In case of error, to delete this service using the following PowerShell CmdLet:

sc.exe delete 'MicrosoftDynamicsNAVServer$NewInstanceName'

Note: don’t remove the instance using Microsoft Dynamics NAV 2013 R2 Administration because this is the Default instance for this build and it will be removed the Service folder from the 71 – Build 36703 folder.

HOW TO add more instances for this build?

In my example, the name will be SecondInstanceName

Method 1:
Using Microsoft Dynamics NAV 2013 R2 Administration tool create a new instance with the name SecondInstanceName.

Copy the SecondInstanceName folder from

C:\Program Files\Microsoft Dynamics NAV\71\Service\Instances\

to

C:\Program Files\Microsoft Dynamics NAV\71 - Build 36703\Service\Instances\

Note: if the subfolder Instances doesn’t exist create it.

Using Microsoft Dynamics NAV 2013 R2 Administration tool delete the instance with the name SecondInstanceName.

Run Microsoft Dynamics NAV 2013 R2 Administration Shell and execute the following PowerShell CmdLet:

New-Service 'MicrosoftDynamicsNAVServer$SecondInstanceName' -BinaryPathName '"C:\Program Files\Microsoft Dynamics NAV\71 - Build 36703\Service\Microsoft.Dynamics.Nav.Server.exe" $SecondInstanceName /config "C:\Program Files\Microsoft Dynamics NAV\71 - Build 36703\Service\Instances\SecondInstanceName\SecondInstanceName.config"' -DependsOn 'HTTP' -Description 'Service handling requests to Microsoft Dynamics NAV application.' -DisplayName 'Microsoft Dynamics NAV Server [SecondInstanceName]' -StartupType Manual

The difference with the previous command is only that now we will refer to the config file inside the Instances folder.

Note: you can replace SecondInstanceName with your preferred name (there are 5 references) or use another name for the folder “71 – Build 36703” (there are 2 references)

The last step is to correct the config files inside the SecondInstanceName folder:

  • SecondInstanceName.config – correct the paths in appsettings and tenants node replacing “71” with “71 – Build 36703”
  • CustomSettings.config – insert the correct values and ports and don’t forget to refer to the Default instance for this build in the following key:
<add key="ServerInstance" value="NewInstanceName" />

Method 2 (by ROEL BERGS):

  1. Change a registry key to the path of the new build
  2. create the SecondInstanceName using Microsoft Dynamics NAV 2013 R2 Administration tool or PowerShell (CmdLet New-NAVServerInstance). This method will create the Instance folder in the correct path.
  3. Changed the registry key value back to the default path.

Following an example of the PowerShell script (run Microsoft Dynamics NAV 2013 R2 Administration tool as Administrator):

$nstDefaultPath = "C:\Program Files\Microsoft Dynamics NAV\71\Service\"
$nstPath = "C:\Program Files\Microsoft Dynamics NAV\71 - Build 36703\Service\"

#Switch registry to correct path
set-itemproperty -path "HKLM:\SOFTWARE\Microsoft\Microsoft Dynamics NAV\71\Service" -name "Path" -value $nstPath

New-NAVServerInstance "SecondInstanceName" -DatabaseName "DBNAME" -DatabaseServer "SQLSERVER" -ClientServicesPort 7046 -SOAPServicesPort 7047 -ODataServicesPort 7048 -ManagementServicesPort 7045

#Switch registry to default
set-itemproperty -path "HKLM:\SOFTWARE\Microsoft\Microsoft Dynamics NAV\71\Service" -name "Path" -value $nstDefaultPath

Note: don’t forget to insert set the correct values in the parameters and you can replace SecondInstanceName with your preferred name (there is 1 reference) or also use another name for the folder “71 – Build 36703” (there is 1 reference).

The last step is to correct the config file inside the SecondInstanceName folder:
CustomSettings.config – insert the correct values and ports and don’t forget to refer to the Default instance for this build in the following key:

<add key="ServerInstance" value="NewInstanceName" />

Method 3:

Download and install the Service Tier Administration Tool from the following link: https://mibuso.com/downloads/service-tier-administration-tool

Did my HOW TO help you? Leave a reply.

Categories
Dynamics NAV Microsoft Registry

Microsoft Dynamics NAV Administration does not work after installation of NAV 2013 R2

After I installed NAV 2013 R2 if I try to run Microsoft Dynamics NAV Administration tool of NAV 2013 I receive the following error message:

—————————
Microsoft.Dynamics.Nav.ManagementUI.dll
—————————
MCC has detected an error in snap-in and will unload it.

– Report this error to Microsoft, and then shut down MCC
– Unload the snap-in and continue running
—————————
OK
—————————

MCC has detected an error in snap-in and will unload it

If I run Microsoft Dynamics NAV Admin tool of NAV 2013 R2, it works only for the instance of the R2 version and if I try to Start/Restart/Stop a server instance of a previous version I receive the following error message:

Error
—————————

The Microsoft Dynamics NAV Admin tool can only manage version 7.1 or later. The ServerInstance ‘{ServerInstance}’ is Version ‘{ServerVersionNo}’.
—————————
OK
—————————

The Microsoft Dynamics NAV Admin tool can only manage version 7.1 or later

Cause:
NAV 2013 and NAV 2013 R2 use different common registry keys, so after installation of NAV 2013 R2 a part of these registry keys are updated with the information of the new installation the main difference are in the path the folder 70 changed with 71 and the version number from 7.0.0.0 to 7.1.0.0.

Microsoft Dynamics NAV Administration does not work after installation of NAV 2013 R2

Idea:

  1. Restore the key with the previous values to fix the functionality of Microsoft Dynamics NAV Administration tool of NAV 2013
  2. Create a new key (as copy of the previous) valid only for NAV 2013 R2

This is the current status in the Registry Editor (click on the image to show more details):
Before FIX Microsoft Dynamics NAV 2013 Administration Keys Status

Solution:

Create a .reg file, using a text editor like Notepad with the following lines:

FIX Microsoft Dynamics NAV 2013 Administration.reg
[sourcecode lang=”bash”]
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.Dynamics.Nav.Management]
"ApplicationBase"="C:\\Program Files\\Microsoft Dynamics NAV\\70\\Service\\"
"AssemblyName"="Microsoft.Dynamics.Nav.Management, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
"Description"="Microsoft Dynamics Nav Management Snap-in"
"ModuleName"="C:\\Program Files\\Microsoft Dynamics NAV\\70\\Service\\Microsoft.Dynamics.Nav.Management.dll"
"PowerShellVersion"="2.0"
"Vendor"="Microsoft Corporation"
"Version"="7.0.0.0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.Dynamics.Nav.Management, Version=7.1.0.0]
"ApplicationBase"="C:\\Program Files\\Microsoft Dynamics NAV\\71\\Service\\"
"AssemblyName"="Microsoft.Dynamics.Nav.Management, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
"Description"="Microsoft Dynamics Nav Management Snap-in"
"ModuleName"="C:\\Program Files\\Microsoft Dynamics NAV\\71\\Service\\Microsoft.Dynamics.Nav.Management.dll"
"PowerShellVersion"="2.0"
"Vendor"="Microsoft Corporation"
"Version"="7.1.0.0"
[/sourcecode]

or download the file FIX Microsoft Dynamics NAV 2013 Administration.zip

Alfter you run the file the status in the Registry Editor will be this (click on the image to show more details)
After FIX Microsoft Dynamics NAV 2013 Administration Keys Status

Note: You have to run the file only once, so after running you can remove it from your computer.

Results:

Now you can manage all the instances using the Microsoft Dynamics NAV Administration tool of NAV 2013 and use the new tool of NAV 2013 R2 to manage ONLY the instance of the new version.

Did my solution solve your problem? Leave a reply.