"Performance counter updating error" after you install the Exchange Server 2013 Client Access server role

Symptoms

After you install the Microsoft Exchange Server 2013 Client Access server role on a new server and then restart the server, you receive many Event ID 106 errors in the Application log. For example, you may receive the following error message: ID: 106 Level: Error Source: MSExchange Common Machine: – Message: Performance counter updating error. Counter name is Per-Tenant KeyToRemoveBudgets Cache Size, category name is MSExchangeRemotePowershell. Optional code: 3. Exception: The exception thrown is: System.InvalidOperationException: The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.\ When you check the Exchange Setup log (ExchangeSetup.log), you see the following information: [WARNING] The performance counter definition file C:\Program Files\Microsoft\Exchange Server\V15\Bin\Perf\AMD64\GlsPerformanceCounters.xml could not be found.

Cause

This issue occur because Exchange Server Setup tries to locate the GlsPerformanceCounters.xml performance counter definition file in the following folder: C:\Program Files\Microsoft\Exchange Server\V15\Bin\Perf\AMD64\ However, Exchange Server Setup should target the following folder instead: C:\Program Files\Microsoft\Exchange Server\V15\Setup\Perf Therefore, the performance counters cannot be loaded.

Resolution

To resolve this issue, use one of the following methods.

Method 1 Use a script to reload all the performance counters
  1. Copy the following script to Notepad, and then save the file as Perfcounters.ps1. Make sure that you change the “$path” value in the script if the Exchange Server is installed in a different location. (This script also applies to Exchange Server 2010.)

     add-pssnapin Microsoft.Exchange.Management.PowerShell.Setup
    $path = "C:\Program Files\Microsoft\Exchange Server\V15\Setup\Perf"
    $items = Get-ChildItem -Recurse $path
    
    $files = $items | ?{$_.extension -eq ".xml"} 
    
    Write-Host "Registering all perfmon counters in $path"
    Write-Host 
    
    $count = 0;
    
    foreach ($i in $files)
    {
       $count++ 
       $f =  $i.directory, "\", $i.name -join ""
    
       Write-Host $count $f -BackgroundColor red
    
       New-PerfCounters -DefinitionFileName $f
    }
    
  2. In Exchange Management Shell, run the file that you created in step 1. For example, run the following command:

     c:\perfcounters.ps1
    

Note Before you run the script, make sure that the execution policy is set to unrestricted. For more information about execution policies, go to the following Microsoft TechNet website: Using the Set-ExecutionPolicy Cmdlet (https://technet.microsoft.com/en-us/library/ee176961.aspx)

Method 2: Load the missing counters manually
  1. Close Performance Monitor, and then stop any other monitoring services that might be trying to use the missing counters.

  2. In Exchange Management Shell, type the following command, and then press Enter.

     Add-Pssnapin Microsoft.Exchange.Management.PowerShell.Setup
    
  3. Run New-PerfCounters to add the performance counters. For example, if you want to load the performance counters that are defined in GlsPerformanceCounters.xml, run the following cmdlet:

     New-PerfCounters –definitionfilename “C:\Program Files\Microsoft\Exchange Server\V15\Setup\Perf\GlsPerformanceCounters.xml
    
 Source: Microsoft TechNet