SP 2013 - Configure Usage and Health Data collection using PowerShell

The Usage and Health Data collection can be configured using PowerShell using Set-SPUsageService and Set-SPUsageDefinition cmdlets.

To enable Usage and Health Data Collection from PowerShell you should first enable logging for usage service and then configure usage providers that you want.

Set-SPUsageService -LoggingEnabled $True

#For all usage providers which should be enabled
Set-SPUsageDefinition -Identiy <Usage Provider Identity/name> -Enable:$True

To make it disabled from PowerShell, you should disable logging in usage service and also disable forall” usage providers (all the ones that are enabled).

Set-SPUsageService -LoggingEnabled $False

#For all usage providers
Set-SPUsageDefinition -Identiy <Usage Provider Identity/name> -Enable:$False