Categories
Dynamics NAV HOW TO Microsoft PowerShell Registry

HOW TO set NAV Service Startup Type via PowerShell

When you create a new Instance using the command New-NAVServerInstance it will set the Startup Type of the NAV Service as “Automatic” by default.

I haven’t found any NAV command to change it, so let us think about NAV Service as any other Windows Service.

In PowerShell there is a command Set-Service that allows to change an existing Service.

NAV Service names have the following format

MicrosoftDynamicsNavServer$<ServerInstance>

where <ServerInstance> is the name of the NAV Instance

So running the following command we can change the Startup Type to Automatic, Manual or Disabled.
[sourcecode lang=”powershell”]Set-Service –Name "MicrosoftDynamicsNavServer`$DynamicsNAV100" –StartupType Manual[/sourcecode]
This example will set the NAV Service for the Server Instance DynamicsNAV100 to Manual.

Unfortunately -StartupType parameter does not have a value for Automatic (Delayed Start)

So it seams a bit tricky but just looking into the register I’ve noted that the other services that had Automatic (Delayed Start) as Startup Type have a REG_DWORD value called “DelayedAutoStart” with value 1 under HKLM\System\CurrentControlSet\Services\

So the idea is use the previous command to set the Startup Type to Automatic then add REG_DWORD via script
[sourcecode lang=”powershell”]Set-Service –Name "MicrosoftDynamicsNavServer`$DynamicsNAV100" –StartupType Automatic
Set-ItemProperty -Path "Registry::HKLM\System\CurrentControlSet\Services\MicrosoftDynamicsNavServer`$DynamicsNAV100" -Name "DelayedAutostart" -Value 1 -Type DWORD[/sourcecode]

In reality we could setup everything from the registry
[sourcecode lang=”powershell”]Set-ItemProperty -Path "Registry::HKLM\System\CurrentControlSet\Services\MicrosoftDynamicsNavServer`$DynamicsNAV100" -Name "Start" -Value 2 -Type DWORD
Set-ItemProperty -Path "Registry::HKLM\System\CurrentControlSet\Services\MicrosoftDynamicsNavServer`$DynamicsNAV100" -Name "DelayedAutostart" -Value 1 -Type DWORD[/sourcecode]

NOTE 1: Both scripts will work only if the current Startup Type is different of Automatic
NOTE 2: “DelayedAutostart” DWORD will have effect only if you setup the Service Type as Automatic.

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.