Create Usage and Health Data Collection Service Application in SharePoint 2013 / 2016 using PowerShell

The Usage and Health data collection service application in SharePoint collects usage and health data from various sources, including event logs, performance counters, search usage data, site collection and site usage data, and server statistics of the entire farm. There are timer jobs to collect data from log files in the 16\LOGS folder, where usage data is initially logged and then updated to the usage database.

Usage and Health Data Collection Service Application can only be created through PowerShell in SharePoint 2013. You’ll get empty reports in Web Analytics reports section, if usage and health data collection service application isn’t configured properly.

Usage and Health Data collection database that should not be part of the Availability Group!

Create Usage and Health Data Collection Service Application in SharePoint using PowerShell:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Configuration Variables
$UsageSAName = "Hosting Farm Usage and Health Data Collection Service"
$DatabaseName = "HostingFarm_Usage_SA"
$DatabaseServer="SP13_SQL"
$UsageLogPath = "D:\UsageLogs\"

#Get the Usage Service Application Service Instance
$ServiceInstance = Get-SPUsageService 

#Create new Usage Service application
New-SPUsageApplication -Name $UsageSAName -DatabaseServer $DatabaseServer -DatabaseName $DatabaseName -UsageService $ServiceInstance #> $null

#Create Service Application Proxy..." 
$proxy = Get-SPServiceApplicationProxy | where {$_.TypeName -eq "Usage and Health Data Collection Proxy"}
$proxy.Provision()

#Set Usage Service Application Option
Set-SPUsageService -LoggingEnabled 1 -UsageLogLocation $UsageLogPath -UsageLogMaxSpaceGB 1 

Here is how it appears on the Service applications page:

create usage and health data collection service application sharepoint 2013
SharePoint Server: Create usage and health data collection service application PowerShell

Please note, Only one instance of the usage and data collection service application can be created for a SharePoint farm! If you try to create one more, you’ll get an “A Usage Application already exists in this farm.” error.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *