Import-Module "NavAdminTool.ps1" shows wrong version and prevents me from restoring native backup

Slawek_Guzek
Member Posts: 1,690
Hi All,
I have a few different NSTs installed side by side on my server. I have installed many version side-by-side by installing base version for each major release, (NAV2016 RTM, NAV2017 RTM, NAV2018 RTM and D365BC RTM) then for cumulatvie updates I have copied the Service folder from the installation image to the appropriate destination (so for example 2018 cu05 went to C:\Program Files\Microsoft Dynamics NAV\110CU05\) and installing the service using sc.exe
Now I am trying to use NavAdminTool.ps1 for NAV2018 CU05 in PowerShell, importing it from the place where the 2018 CU05 is installed and runs from.
I am using command
However after importing the module PowerShell shows me incorrect version of imported module and commandlets (11.0.19... while it should be 11.0.21836)

I have checked other binaries in C:\Program Files\Microsoft Dynamics NAV\110CU05\Service\ location and they have correct and expected build numbers:

What I am doing wrong? What should I do to force correct version of NavAdminTool to be imported?
I have tried so far
Thanks,
Slawek
I have a few different NSTs installed side by side on my server. I have installed many version side-by-side by installing base version for each major release, (NAV2016 RTM, NAV2017 RTM, NAV2018 RTM and D365BC RTM) then for cumulatvie updates I have copied the Service folder from the installation image to the appropriate destination (so for example 2018 cu05 went to C:\Program Files\Microsoft Dynamics NAV\110CU05\) and installing the service using sc.exe
Now I am trying to use NavAdminTool.ps1 for NAV2018 CU05 in PowerShell, importing it from the place where the 2018 CU05 is installed and runs from.
I am using command
Import-Module "C:\Program Files\Microsoft Dynamics NAV\110CU05\Service\NavAdminTool.ps1"
However after importing the module PowerShell shows me incorrect version of imported module and commandlets (11.0.19... while it should be 11.0.21836)

I have checked other binaries in C:\Program Files\Microsoft Dynamics NAV\110CU05\Service\ location and they have correct and expected build numbers:

What I am doing wrong? What should I do to force correct version of NavAdminTool to be imported?
I have tried so far
Import-Module "C:\Program Files\Microsoft Dynamics NAV\110CU05\Service\NavAdminTool.ps1"and
CD "C:\Program Files\Microsoft Dynamics NAV\110CU05\Service\" Import-Module "NavAdminTool.ps1"
Thanks,
Slawek
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
0
Comments
-
Hello @Slawek_Guzek ,
The problem is that even though you import the NavAdminTool.ps1 from the right path, inside there is the line remarked in green that force the path from the register under that key, so you need to change that key to point to the path you want.
Regards.
1 -
Hello,
Actually, NavAdminTool.ps1 is just a script that loads commands from a .Net Assembly and it looks for this assembly in a path declared in the Windows Registry.
Edit NavAdminTool.ps1 with a text editor and you should find a registry path (ie. : HKLM:\SOFTWARE\Microsoft\Microsoft Dynamics NAV\110\Service)
Modify the Path according to the installation path of your CU.
It should work after that
1 -
Thank you @ftornero and @nicolassaleron
It only worked when I duplicated the HKLM:\SOFTWARE\Microsoft\Microsoft Dynamics NAV\110\Service" key in he registry and amend the paths in there, or when I changed both $nstPath and $snapInAssembly path definition
It didn't want to work with this alone
$nstPath = "C:\Program Files\Microsoft Dynamics NAV\110CU05\Service"
I've tried to run first few comands form the script manually and got this
I can live with the modifiaction of both $nstPath and $snapInAssemblym but I'd be grateful if you help me understand why modification of $nstPath alone didn't work, as from your answers I understood that if should be sufficientSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
Hello @Slawek_Guzek ,
If you change the $nstpath to a string, then you need to change the two next lines to reflect that, because there is not an object anymore and have not properties.
Form this:
To this:
1 -
Thank you @ftorneroSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions