Thursday, September 29, 2022

HowTo: create a “Usage and Health Data Collection” via powershell

Abstract: Creating a new “Usage and Health Data Collection” via poweshell for Sharepoint 2010 and Sharepoint 2013 is quite easy and required only some steps:

1.) Login to the Sharepoint OS with an account which has the rights to perform the needed task

2.) Create our “Usage and Health Data Collection” DB via:
$serviceInstance = Get-SPUsageService
New-SPUsageApplication -Name “Usage and Health Data Collection Service” -DatabaseServer “mySQLServer.contoso.local” -DatabaseName “EMEA_SharePoint_Farm_Usage” -UsageService $serviceInstance
3.)    If you check the “Application Management” -> “Manage service applications” you will see that “Usage and Health Data Collection Proxy” is stopped. So we need to push out the following via powershell:
$sap = Get-SPServiceApplicationProxy | where-object {$_.TypeName -eq “Usage and Health Data Collection Proxy”}
$sap.Provision()
If you now reload the page, you can see it is started
4.)    Now go to “CA > Application Management > Manage Content Databases” and click on your content database and select your server for the “Preferred Server for Timer Jobs”.

You can now enable the log space and move them to another folder via (OPTIONAL):
Set-SPUsageService -LoggingEnabled 1 -UsageLogLocation “C:\SPLogs\” -UsageLogMaxSpaceGB 2

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Stay Connected

23FollowersFollow
- Advertisement -

Latest Articles