In my previous article Dynamics NAV Server hack by examples I’ve enumerated some tips on how to create and maintain NAV servers in a very hacky way.
In this article I want to show you how to use Powershell modules with the same NAV/BC version but different cumulative updates on the same machine.
Please note that from now on I’ll refer to Business Central (BC) only but this article applies to Dynamics NAV as well.
I’ll describe the steps I’ve followed to install BC Spring Release RTM (14.0.29530.0) and BC Spring Release CU2 (14.0.34444.0) in the same machine.
BC Installation (NST, RTC & Web Client)
- To install BC SR RTM run the setup from the installation files
Please note that I’ve changed the installation path and database name adding the suffix _RTM to distinguish from later versions where I’ve used the _CU2 suffix.
- After the installation I’ve tried to install BC SR CU2 from the installation files as well but I didn’t have the option to install BC SR CU2 as a different application. The setup shows that BC Spring Release is already installed although I’m installing a different cumulative update.
- If I try to run the ServiceTier setup executable directly I get the following error message:
Well, it seems that Microsoft doesn’t allow us to install two cumulative updates for the same NAV/BC version in the same machine.
How to handle this?
- Manually copy the Server, RoleTailored and WebClient folders from the installation dvd:
ServiceTier\program files\Microsoft Dynamics NAV\140 to C:\Program Files\Microsoft Dynamics 365 Business Central\140_CU2
RoleTailoredClient\program files\Microsoft Dynamics NAV\140 to C:\Program Files\Microsoft Dynamics 365 Business Central\140_CU2
WebClient\Microsoft Dynamics NAV\140 to C:\Program Files\Microsoft Dynamics 365 Business Central\140_CU2
Powershell modules installation
- Let’s create the BC server. We have two options. Option 1 is to use ServiceTierAdministration. I won’t detail that in this article. Option 2 is to use BC Powershell modules. Let’s do it.
- UPDATE: 2021-08-18 – Check my new article about ServiceTierAdministrator (https://ricardomoinhos.com/pt/managing-nav-bc-server-instances-with-servicetieradministrator/)
- Open Powershell ISE as administrator and import BC SR RTM modules first.
Import-Module “C:\Program Files\Microsoft Dynamics 365 Business Central\140_RTM\Service\NAVAdminTool.ps1” -force
Version is 14.0.29530 so it is ok.
- Now close Powershell ISE (it is mandatory), open it again and import BC SR CU2 modules instead.
Import-Module “C:\Program Files\Microsoft Dynamics 365 Business Central\140_CU2\Service\NAVAdminTool.ps1” -force
Version 14.0.29530 again. Ups, something went wrong! 🙂
This is happening because the BC module reads the BC Service path in Windows Registry.
In the Windows Registry I have:
So what do we need to do?
- First, edit and change the module script.
- Create a new entry for CU2 in Windows Registry
- Close and reopen Powershell ISE. Import the module again and… voilá, version 14.0.34444 as expected
Now we’re able to create the BC service using Powershell command because the service will be created with the correct version.