Tag Archives: microsoft dynamics

Find active users in NAV using SQL

Here is a simple query to discover who are the users that are currently connected to your Dynamics NAV instance using SQL Server Management Studio:

USE DatabaseName
SELECT [User ID],[Client Computer Name],[Login Datetime] from [Active Session]

This will return you the user ID, computer name and the login time of the user. You can use * instead if you want to get all the data:

SELECT * from [Active Session]

You can also add a where clause if you are looking for something specific in an instance with large user count, for example:

USE DatabaseName
SELECT [User ID],[Client Computer Name],[Login Datetime] from [Active Session]
WHERE [User ID] LIKE ‘%john%’



You recieve a message from the web browser: “A script error has occurred” In NAV load balanced environment

I have stumbled upon this issue while configuring a Dynamics NAV 2015 Load Balanced solution combined with Forms Authentication.
In this scenario you will randomly get this error while browsing the NAV Web Client:

“A script error has occurred, and the content cannot be displayed. Refresh the page or open a new browser window”

At the same time you will find an ASP.NET warning in the event log on one of the front servers saying:
“An error occurred processing a web or script resource request. The resource identifier failed to decrypt”


So what’s going on here?

Turns out that in order to work with forms authentication with NLB you need to configure Identical Machine Keys on both IIS servers that host your Dynamics NAV Web Client:


1. Go to IIS on your first server and go to Machine Keys:

2. Remove the check-box from both “Automatically Generate at runtime” options and then click Generate Keys.

3. Hit apply and copy both keys to notepad.
4. Go to IIS on your second server and paste the keys generated on the first server to the machine keys respectively.
5. Hit apply and do an IISRESET on both servers

This action should solve the script errors


Move AX 2012 to a different Server / Domain

As you probably know Microsoft Dynamics AX 2012 R2/R3 does not have a redeployment utility (like the Dynamics CRM deployment manager) meaning that if you want to move an AX Deployment from one domain to another – you’ll have to get your hands a little dirty.

Some important notes before we start :

  • You can use these steps also in AX 2012 – Just ignore the Modelstore database.
  • You can also use these steps to move a deployment in the same domain – ignore step 4.
  • You need to make sure that the AX installation version in the new server matches the installation
    on the previous server.
  • I’m assuming that you have the basic required knowledge in SQL Server, your Windows Serverenvironments and of course some AX 2012 architecture understanding to do these steps 🙂

Let’s go:

1. Open the SQL management studio and Backup your AX Databases [BusinessData Database + Modelstore Database] for example: AXProd + AXProd_model
2. Stop the AX Service on the new server and restore the databases in the new SQL server – You can restore them with different names just remember that they have to match – for example: AXProdNEW
3. In the SQL management studio run the following queries on the BusinessData Database (AXProdNEW):


— This will delete the AOSID & SERVERID of the previous installation and will
— repopulate the tables with the new server name when the AX service on the new server is started.

Also consider running:


— This will clear the Reporting Services properties form – you will need to reconfigure this
— later if you want to redeploy the reports.


— This will delete the batch server properties of the previous server – You should do this if
— the redeployment is in the same domain because the old server might be reachable by the new one and may use it as a batch server.


— This will delete the SMTP server parameters for sending emails

4. Now you need to configure your user in the AX Database in the new domain (You can skip this step if you re-deployed AX in the same domain).
Open CMD with “Run as admin” and type:

wmic useraccount where (name='your_windows_username' and domain='your_domain') get name,sid

Example: wmic useraccount where (name='administrator' and domain='contoso') get name,sid

Copy the SID to notepad.

In the SQL management studio run the following query on the BusinessData Database (AXProdNEW):

SET SID='your_sid', NETWORKALIAS='your_windows_username', NETWORKDOMAIN='your_domain', NAME='your_full_name'
WHERE ID = 'Admin'


SET SID='S-1-5-21-916693446-2822637979-541647007-1001', NETWORKALIAS='administrator', NETWORKDOMAIN='contoso', NAME='John TheAdmin'
WHERE ID = 'Admin'

— This will replace the AX Admin user to your user – you can modify this query to replace other
— users as well, or you can later add new users from the AX GUI.

5. Grant the AX AOS account permissions over the databases as follows:




You can identify the AOS account by going to the services on the application server (start->
services.msc) and check the Log On tab:

If you are using NETWORK SERVICES as the service account you will need to grant permissions to the machine$ account – Use the following query to do it:

CREATE LOGIN [Domain\axservername$] FROM WINDOWS

6. All done! Go to services on the application server and start the Microsoft Dynamics AX Service –
it might take a few minutes for it to start. Once it’s running – you can start the application.
If you have any issues starting the service check the server’s event log for clues, and if you have
any questions – feel free to post them here and i will do my best to help you out.

Further optional steps:

1. You should synchronize your Database to make sure everything is working properly.
2. If you want to deploy your reports – you need to fill the Report Servers form and then run the
following command from the Dynamics AX 2012 management Shell:

Publish-AXReport –ReportName *

I hope you find this post helpful! Good luck, Michael.

Microsoft Dynamics NAV 2015 Installation Guide

Hello everyone!

A new video tutorial is available on my YouTube channel – this time a step-by-step installation guide for Microsoft Dynamics NAV 2015 with SQL 2014 – Check it out:

This is a very straight-forward guide that explains how to setup a working environment with the Demo Cronus Database from Microsoft – You can use this for your Tests, Development & Presentation servers – and the installation process is also relevant for a small Production Environment. I hope you find this useful – If so – don’t forget to subscribe 🙂

CRM async service high CPU usage

There are many scenarios that can cause a high CPU utilization by the CRM asynchronous service, here are some
of the most common ones i encountered:

1. Check if the AsyncOperationBase table doesn’t have too many records in it. Once this table has millions of records – things may start working very slow. Use the following article to solve this issue and to create a proper maintenance plan to prevent this from happening:


2. Use the CRM Advanced Find to search for locked system jobs – this is a very common issue that can cause the
async service to go havoc and utilize 100% of the CPU on the server ALL THE TIME – even when there is
absolutely zero activity in the system.

If you find any locked system jobs with the advanced find – delete them and restart the async service.


3. Check the email router and the emails in the system:

Use the Advanced find to see if there are any emails stuck in sending status, if so – try deleting them and investigate why they got stuck in the first place. You should also try stopping the email router service to eliminate it as the cause and check the event log to see if there are any “suspicious” emails in the queue. Sometimes emails with special characters or some sort of corruption can cause issues with the async service (although they are not supposed to, i did encounter it).

4. RESTART! try restarting the server/asynchronous service. Sometimes restarting the system is the simplest
solution, so before you start investigating the problem and wasting hours on hours of your time – make sure you do system reboot first.

5. If none of the above helps you should try investigating further and farther.

  • Check your SQL server logs, performance & event log for any suspicious entries.
  •  Try tracing the CRM and analyze the trace file for any errors or exceptions. Use this article to enable tracing for CRM: http://support.microsoft.com/kb/907490
  • Try to see if maybe a 3rd party entity is causing the problem: Antivirus, Firewall etc.

Good Luck 🙂