Close this search box.

PowerShell Script to Workaround No Data in SharePoint 2013 Usage Reports

Over the past few months I’ve had 2 customers that have run into an scenario where the SharePoint 2013 web analytics usage reports have no data (all zeroes) in the reports.  While working with some brilliant Microsoft escalation engineers (thanks Anthony and Jason) we were able to run some PowerShell scripts that added receivers to start data showing again on the following day.  Since I haven’t seen any posts on this as of yet I thought I would post a version of the PowerShell scripts we used.


In SharePoint 2013 the search service application incorporates web analytics (which is a separate service application in SharePoint 2010).  Web analytics processes usage logs on the SharePoint machines and generates reports on a daily schedule.  These reports can be viewed for an individual site in the site settings under Site Collection Administration > Popularity and Search Reports.

In the Popularity and Search Reports you can click on the Usage report which will launch an Excel workbook.

What I found with 2 customers and one of my lab farms was that the Usage report contained all zeroes for data even though the customer (and me in my lab farm) had been using the site regularly with multiple accounts over the past few days.

e analyzed the logging database and found that it had usage data, but the search analytics database did not.  (Note: do not directly query the search analytics database as that is unsupported as of the time this post was written.  See for more information.)  So it appeared the data in the logging database wasn’t being processed by the search service web analytics timer jobs.  After verifying that the timer jobs were indeed running the long road of PowerShell queries into the system began.  We finally used the below commands to arrive at what we believe to be the culprit for these customers.  Our findings follow the commands.

001 002 003 004 005 $aud = Get - SPUsageDefinition |
    where { $_.Name - like "Analytics*" } $aud | fl

                                                     $prud = Get - SPUsageDefinition |
    where { $_.Name - like "Page Requests" } $prud | fl
  • AnalyticsUsage usage definition had no Receivers defined
  • PageRequest usage definition had no Receivers defined

Not having any Receivers defined also led to the EnableReceivers property to be set to false for both.


The workaround in these scenarios was to manually create the Receivers.  The PowerShell commands to do so is below (slightly modified to check for empty receivers first).  Again this sample script is provided as-is with no warranty.  Do not run this in your environment without first testing.  This is not an official Microsoft approved script.  You can download a copy off my SkyDrive folder as well.

001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 if (
    (Get - PSSnapin - Name Microsoft.SharePoint.PowerShell) -
    eq $null) { Add - PSSnapin Microsoft.SharePoint.PowerShell }

$aud = Get - SPUsageDefinition |
    where {
  $_.Name - like "Analytics*"

#if analytics usage definition receivers is empty then manually add back receiver
if ($aud.Receivers.Count - eq 0) {
      "Microsoft.Office.Server.Search.Applications, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c",

#if analytics usage definition receiver is not enabled then enable it
if ($aud.EnableReceivers - eq $false) {
  $aud.EnableReceivers = $true $aud.Update()

$aud | fl

           $prud = Get - SPUsageDefinition |
    where {
  $_.Name - like "Page Requests"

#if page requests usage definition receivers is empty then manually add back receiver
if ($prud.Receivers.Count - eq 0) {
      "Microsoft.Office.Server.Search.Applications, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c",

#if page requests usage definition receiver is not enabled then enable it
if ($prud.EnableReceivers - eq $false) {
  $prud.EnableReceivers = $true $prud.Update()

$prud | fl

After the script has been run the output from the prior commands can confirm that Receivers have been created and the EnableReceivers property is set to true.

Waiting one day the usage reports were now showing data.  (Note the below report was mocked up manually to show data as I did not have direct access to the customers’ reports, but this is consistent with what we had seen after the scripts were applied.)


This is a strange scenario of no data in the usage reports when there is data in the logging databases.  I’ve run into it myself and with 2 customers, but when I tried to reproduce the scenario I couldn’t.  If anyone is facing this issue hopefully this process of manually creating the usage definition receivers and waiting 24 hrs is a workaround.  Let me know if you have seen this and if the workaround works for you.  Curious to learn more on it.

      -Frog Out

This article is part of the GWB Archives. Original Author: The Frog Pond of Technology

Related Posts