How to resolve AAD Connect performance counters error (Event 6313)

During a recent upgrade of Azure AD Connect I encountered the following error in the Application event log:

Log Name:      Application
Source:        ADSync
Date:          05-12-2016 11:28:21
Event ID:      6313
Task Category: Server
Level:         Information
Keywords:      Classic
User:          N/A

The server encountered an unexpected error creating performance counters for management agent “”.
Performance counters will not be available for this management agent.


After analyzing the issue in details I found that this occur when AAD Connect installation lack permissions to write performance counter information correctly in the local Registry.

To avoid this issue in the first place, always start Azure AD Connect installation or upgrade from an elevated command prompt or an elevated PowerShell prompt.


Fixing the issue after Azure AD Connect is installed, require either that AAD Connect is first un-installed and then properly re-installed (from an elevated command prompt), or that the following changes are done to re-register the ADSync performance counters.

To perform re-registration of the ADSync performance counters, first open an elevated PowerShell prompt and stop the three Azure AD Connect services:

Stop-Service AzureADConnectHealthSyncInsights
Stop-Service AzureADConnectHealthSyncMonitor
Stop-Service ADSync




Next, we need to make a change in the local Registry, but before this ensure that you have a backup of the Registry key.

Open the local Registry and right-click on the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSync\Performance key

Select Export and save the key to a .REG file


Right-click the following registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSync\Performance and select Delete


Before proceeding, create a new Performance key in the Registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSync\
Switch back to the elevated PowerShell prompt and two commands to unload and create the performance counters.

Run the first command to remove performance counters name and explain text for the ADSync performance counters:

unlodctr.exe ADSync


Run the second command to register name and explain text of the ADSync performance counters, based on the information in the mmsperf.ini file:

lodctr.exe “C:\Program Files\Microsoft Azure AD Sync\Bin\mmsperf.ini”


Start the Azure AD Connect service from the elevated PowerShell prompt:

Start-Service AzureADConnectHealthSyncInsights
Start-Service AzureADConnectHealthSyncMonitor
Start-Service ADSync



Review the Application log for the event ID 1000 for confirmation that the performance counters are successfully loaded:

Log Name:      Application
Source:        Microsoft-Windows-LoadPerf
Date:          05-12-2016 11:43:41
Event ID:      1000
Task Category: None
Level:         Information
User:          N/A

Performance counters for the ADSync (Microsoft Azure AD Sync) service were loaded successfully.
The Record Data in the data section contains the new index values assigned to this service.



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.