Usage and Health Data Service Application Stopped; and a little bit-o-PowerShell

Posted: Grant | Comments: 0 | April 8th, 2011
Apr 08

If you’ve had the opportunity to work with any of the new Microsoft server products, you’ve undoubtedly become aware of the power of the PowerShell commandlets that ship with many of the new products. As a developer at heart, and a SharePoint developer/administrator by trade; I am enlightened daily by the many things that are possible with the SharePoint 2010 Management Shell. In a world where we are constantly seeking more and more automation, developers and admins alike are going to have to get comfortable writing code… I mean scripts.

I was faced with an example of this today. I was assisting in the building of a new SharePoint 2010 farm and I had noticed that the Usage and Health Data Service Application Proxy was stopped. Having seen this before, I knew that there wasn’t a way (at least that I know of) to start the service application proxy from Central Administration, so I would have to resort to the SharePoint 2010 Management Shell; which I am growing to love more and more by the day. A quick two lines of script, and the service application proxy was back online:

$svcAppProxy = Get-SPServiceApplicationProxy | Where {$_.Name -eq "Usage and Health Data Service Application Proxy"}
$svcAppProxy.Provision()

#End

Almost seems too easy, doesn’t it?

Now, I know this this is a pretty basic example but I feel it is worth noting for these two very important reasons:

  1. It illustrates that PowerShell isn’t just for the developer. This was an administrative task and we’ll all need to be on board to support such a scenario.
  2. PowerShell scripting doesn’t have to be intimidating. Gary LaPointe’s blog is a fantastic place to see just how far you can take PowerShell and automation with SharePoint. But as we saw above, PowerShell is great for small tasks too.

Writing PowerShell scripts doesn’t have to be a pain!

The thing that I always hated about batch files and STSADM was the fact that writing batch commands was such a cryptic experience. We’re used to nice IDEs, so if we are going to be expected to write scripts for these products; we’ll need good tools to write and test our scripts.

The community around PowerShell is growing and so are the tools. Personally, I’m a fan of PowerGUI by Quest Software. PowerGUI can load external PowerShell libraries (like SharePoint) and even has intellisense, as shown in the screen captures below:

Adding Snapin

Adding Snapin

PowerGUI Intellisense

PowerGUI Intellisense

As you can see, with the right set of tools; our script from above is pretty simple isn’t it?

Leave a Comment