Performance Counter corruption causes StoreFront installation to fail with "An Unexpected Error occurred. Contact Citrix Technical support"

Performance Counter corruption causes StoreFront installation to fail with "An Unexpected Error occurred. Contact Citrix Technical support"

book

Article ID: CTX270779

calendar_today

Updated On:

Description

When this occurs you see the message “An Unexpected Error occurred. Contact Citrix Technical support”. This following entry appears in the StoreFront log files (described in https://docs.citrix.com/en-us/storefront/current-release/troubleshoot.html ):

System.InvalidOperationException: The installation failed, and the rollback has been performed. ---> System.ComponentModel.Win32Exception: Unknown error (0xc0000142) at System.Diagnostics.PerformanceCounterLib.RegisterFiles(String arg0, Boolean unregister)

Resolution

To fix the corruption, and allow StoreFront to be installed correctly, rebuild the Performance Counters counters using the following steps on the virtual machine that was exhibiting the problem:

1. Restore the affected virtual machine from a Snapshot or template.
2. Rebuild Performance Counters, together with extensible and third-party counters, type the following commands at an Administrative command prompt. Press ENTER after each command.
cd c:\windows\system32
lodctr /R
cd c:\windows\sysWOW64
lodctr /R
WINMGMT.EXE /RESYNCPERF
3. Stop and restart the Performance Logs and Alerts service. 
4. Stop and restart the Windows Management Instrumentation service.

Problem Cause

When a virtual machine is restored from a template or a snapshot, Windows Performance Counters can sometimes be corrupted. When this happens, StoreFront cannot be installed correctly and may prevent you from adding a Delivery Controller to a Citrix Virtual Apps and Desktops Site. This is a rare and unpredictable issue which impacts StoreFront but which is not caused by StoreFront itself. 

Additional Information

https://support.microsoft.com/en-ca/help/2554336/how-to-manually-rebuild-performance-counters-for-windows-server-2008-6