Enable developer dashboard question for SP2016
-
16-02-2021 - |
Question
I failed to find official article about how to enable Developer Dashboard for SP2016. The only one I can find is this old one for SP2010 foundation.
The PowerShell script it suggested is :
(Get-SPFarm).PerformanceMonitor.DeveloperDashboardLevel = "On"
However I also find some other blogs recommend this one:
$var = Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
$var.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On
$var.Update()
Are they actually the same? Or they have different behavior?
Solution
Use below code to enable developer dashboard:
$ContentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$DevDashboard = $ContentService.DeveloperDashboardSettings
$DevDashboard.DisplayLevel = "On"
$DevDashboard.Update()
Note: Make sure that you have an active and running "Usage and Health Service Application" service application as developer dashboard directly depends on it.
Reference: Enable Developer Dashboard In SharePoint Server 2016
OTHER TIPS
Just did a test in my SP16, The Official PowerShell example
(Get-SPFarm).PerformanceMonitor.DeveloperDashboardLevel = "On"
doesnot work. I get the error like this:
I find this article with the similar issue: https://techtrainingnotes.blogspot.com/2010/05/sharepoint-2010-developer-dashboard.html
You need to use the second one. This works for me.
$var = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
$var.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On
$var.Update()