Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > How to use Windows PowerShell to configure the Developer Dashboard
March 29
How to use Windows PowerShell to configure the Developer Dashboard

The Developer Dashboard is a great way in SharePoint 2010 to see what's going on behind the scenes when a page is loading in SharePoint. It breaks down the components of the page and how long they took. It also lists out information like how many SQL queries have been run, critical events, the correlation ID, and other important information. The Developer Dashboard can be set to on, off, or ondemand at will for your farm. Some folks will do it with STSADM using the command "stsadm –o setproperty –pn developer-dashboard –pv [on|off|ondemand]" choosing the level they want the developer dashboard to be at. We will mock those people and call them bad names. We know by now that the cool kids all use Windows PowerShell to manage SharePoint 2010. How does one do that? Unfortunately it is a little more difficult in PowerShell, but we'll fix that later. First, the ugly details. Here is the PowerShell code you would use to configure the developer dashboard:

$dash =


$dash.DisplayLevel = 'OnDemand';

$dash.TraceEnabled = $true;



This sets the developer dashboard to "ondemand." You can also set it to On or Off. You'll notice we do have an additional setting we can set with PowerShell, TraceEnabled. We'll cover that later. If we turn the Developer Dashboard on we'll get the following dashboard at the bottom of our web pages:

If we choose ondemand the dashboard won't show on page load, but we'll get an icon up by our name to enable it. Also notice at the lower left corner of the page there is a link to enable the tracing information. That's where it gets really deep and technical. Show that to your STSADM using friends.

I mentioned earlier that the PowerShell code above is kind of ugly, and you likely won't memorize it. To help all my faithful readers out, I've written a couple of PowerShell functions to help you out. Here's what they look like when they're used:

First you need to run the PS1 file to add the functions to PowerShell. That's the . .\devdashboardfunction.ps1 part.

Now you can use the two functions I wrote, Get-SPDeveloperDashboard and Set-SPDeveloperDashboard to get your current settings and set new settings. When you set new settings, the new settings will be displayed for you. What does the code look like? Well, it's pretty simple, or else I wouldn't be able to do it.

# PowerShell functions to deal with the Developer Dashboard

# Author: Todd Klindt

# Contact:

# Version 1.0 March 28th, 2010


function Get-SPDeveloperDashboard


$dash = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;

Write-Host "DisplayLevel = " $dash.DisplayLevel;

Write-Host "TraceEnabled = " $dash.TraceEnabled;



function Set-SPDeveloperDashboard

{param ($DisplayLevel, $TraceEnabled)



on {$level = "on"; break}

off {$level = "off"; break }

ondemand {$level = "ondemand"; break}

default {"Please enter On, Off, or Ondemand for the DisplayLevel";break}

} # end of switch



$null {break}

on {$tracelevel = $true;break}

off {$tracelevel = $false;break}

true {$tracelevel = $true;break}

false {$tracelevel = $false;break}

default {"Please enter On or Off for TraceEnabled";break}

} # end of switch

if ($level -ne $null) {

$dash = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;

$dash.DisplayLevel = $level;

if ($tracelevel -ne $null) {

$dash.TraceEnabled = $tracelevel;




} # end if

} # end of Set-DeveloperDashboard


You can download the file devdashboardfunction.ps1 from here. Let me be very clear. You should NEVER download and execute PowerShell code you find on the Internet, ESPECIALLY if it's something I've written. I'm an idiot and honestly I'm surprised that works, let alone works well. For all I know that code my delete your SharePoint farm, format your server, and let the air out of your tires. Whenever you grab a PowerShell script from the Internet read it over and understand what it does before you use it. And don't come crying to me if your cat ends up getting shaved after your run this. Consider yourself warned.

This code adds the two functions I wrote to PowerShell. Once they are there you can use tab complete on the function names, and their parameters. The functions are essentially what we looked at above, along with some very, very basic error checking. If any developers read my blog I'm sure milk just shot out their nose when they read my code. It's a good thing, you don't have to worry about me stealing your jobs or anything. J

Hope that helps some folks. If you want more information on the Developer Dashboard, let me know. I'll write up more about it.



Error with PowerShell

Todd, nice post, however I get an error finding the type, this happens using both the standard powershell or your new functions - any idea what I'm doing wrong?

Unable to find type [Microsoft.SharePoint.Administration.SPWebService]: make sure that the assembly containing this typ
e is loaded.
At line:1 char:59
+ $dash = [Microsoft.SharePoint.Administration.SPWebService] <<<< ::ContentService.DeveloperDashboardSettings;
    + CategoryInfo          : InvalidOperation: (Microsoft.Share...on.SPWebService:String) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound
 on 4/1/2010 7:59 AM

Re: Error with PowerShell

You need to run it in the SharePoint 2010 Management Shell or run "add-pssnapin microsoft.sharepoint.powershell" in a PowerShell console.

Todd O. KlindtNo presence information on 4/1/2010 10:11 AM

Re: How to use Windows PowerShell to configure the Developer Dashboard

Nice! It works.
 on 12/8/2010 5:54 PM

Re: How to use Windows PowerShell to configure the Developer Dashboard

These are my favorite types of comments. :)

Todd O. KlindtNo presence information on 12/15/2010 8:43 AM

On Demand?

If I use this option, does every have the icon to enable it?

 on 3/11/2011 9:48 AM

Re: On Demand?

No, only users that have the "CustomizePage" permission or higher will see it.

Todd O. KlindtNo presence information on 3/12/2011 2:38 PM

Thanks - its working

Opened PowerShell as adimin and typed in ($dash) 5 lines from the top of the page and my dashboard is now activated.  Thanx.
 on 3/16/2011 11:22 PM

Trace Explanation?

I was curious if you culd go into more depth on what the Trace Enabled does? I read back over the post a couple of times, but it seems I must have missed something.

 on 5/12/2011 12:44 PM

Good Post

Thank you Todd, It was quite helpful for me.
 on 9/20/2011 3:23 PM

Re: Good Post

Thanks. I'm glad you enjoyed it.

Todd O. KlindtNo presence information on 9/20/2011 3:28 PM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.


Body *

Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person


Want a message when I reply to your comment? Put your Twitter handle here.