Powershell ISE and multiple NAV-versions: Where to define which NAV-version ISE should use?

MariaNAV
Member Posts: 5
Hello All
I am working on a small Powershell script that will run a NAV codeunit. I recently installed NAV2016 (9.0) as a test before our upgrade sometime next year (we are now running NAV2013r2 (7.1)), so I have two versions running.
Powershell ISE automatically runs the 9.0 version (apparantly because that is the most recently installed?), but I want it to automatically run the 7.1 version.
So my question is: Where is the setting where you which NAV-version it uses as standard? Or alternatively: Can I define somewhere in a script that it should use one version instead of the other?
I have found a workaround, which is easy but not optimal: If I just take the "71" folder in "C:\Program Files (x86)\Microsoft Dynamics NAV" and rename it to"90", the PowerShell ISE program will run the exe-file in 90-folder, althorugh it contains the 71-version. But I whould much rather that the program just started NAV-version in the 71 folder.
Thank you so much in advance.
Regards,
Maria
I am working on a small Powershell script that will run a NAV codeunit. I recently installed NAV2016 (9.0) as a test before our upgrade sometime next year (we are now running NAV2013r2 (7.1)), so I have two versions running.
Powershell ISE automatically runs the 9.0 version (apparantly because that is the most recently installed?), but I want it to automatically run the 7.1 version.
So my question is: Where is the setting where you which NAV-version it uses as standard? Or alternatively: Can I define somewhere in a script that it should use one version instead of the other?
I have found a workaround, which is easy but not optimal: If I just take the "71" folder in "C:\Program Files (x86)\Microsoft Dynamics NAV" and rename it to"90", the PowerShell ISE program will run the exe-file in 90-folder, althorugh it contains the 71-version. But I whould much rather that the program just started NAV-version in the 71 folder.
Thank you so much in advance.
Regards,
Maria
0
Best Answer
-
Open RegEdit from Commandprompt
select HKEY_LOCAL_MACHINE\SOFTWARE\Classes\DYNAMICSNAV\Shell\Open\Command
Change path from 90 to 71...1
Answers
-
Doesn't Import-Module '%programfiles%\Microsoft Dynamics NAV\71\Service\NavAdminTool.ps1 do the job?0
-
Thank you for the reply.
No, if I use Import-Module 'C:\Program Files\Microsoft Dynamics NAV\71\Service\NavAdminTool.ps1' it will stil try to run the exe-file in the 90-folder, so the imported NavAdminTool-file does not influence which folder the subsequent powershell script uses.
FYI, I am following Waldo's guide to running af codeunit from Powershell (http://www.waldo.be/2015/07/09/start-nav-object-in-rtc-with-powershell/), and this is my codeImport-Module 'C:\Program Files\Microsoft Dynamics NAV\71\Service\NavAdminTool.ps1' function Start-NAVApplicationObjectInWindowsClient { [cmdletbinding()] param( [string]$ServerName=[net.dns]::Gethostname(), [int]$Port=6411, [String]$ServerInstance, [String]$Companyname, [string]$Tenant='default', [ValidateSet('Table','Page','Report','Codeunit','Query','XMLPort')] [String]$ObjectType, [int]$ObjectID ) $ConnectionString = "DynamicsNAV://$Servername" + ":$Port/$ServerInstance/$Companyname/Run$ObjectType"+"?$ObjectType=$ObjectID&tenant=$tenant" Write-Verbose "Connectionstring: $ConnectionString ..." Start-Process $ConnectionString } Start-NAVApplicationObjectInWindowsClient -ServerName ([net.dns]::GetHostName()) -ServerInstance MyService-Tenant MyTennat-ObjectType Codeunit -ObjectID 6169471
0 -
Open RegEdit from Commandprompt
select HKEY_LOCAL_MACHINE\SOFTWARE\Classes\DYNAMICSNAV\Shell\Open\Command
Change path from 90 to 71...1 -
mohana_cse06 answered the question, thank you! That works perfectly.
Thank you again0
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