Friday, January 27, 2012

Get-SPTimerJob - Finding timer jobs not shown in Central Admin

Bamboo Alerts Plus Timer Jobs (and displaying wide format data from powershell)
While deploying and testing Bamboo Alerts Plus webpart for SharePoint 2010 on a multi-server farm my team recently discovered the timer jobs were not visible on the central admin server under monitoring.  But, the timer jobs were running, because alerts were being sent.  The jobs were shown on single server farms.
Through some creative efforts we discovered the timer jobs residing on the web front end servers and set about finding a simple process to report on the status of the jobs… enter powershell for SharePoint.  
Using powershell’s Get-SPTimerJob commandlet we got a listing of the timer jobs running on each server.  But, the identity name was being truncated even in the standard 80 character width of powershell when using Get-SPTimerJob |format-table -autosize.  So, I wrote up this procedure for our farm admins.
How to find the identity for the Bamboo Alert Plus Custom Timer Job:
Open SharePoint Powershell.  Select icon in top left and choose Properties.
Under Properties select Layout Tab and change Screen Buffer Size to a width of 200+.  Run this to get a listing of all timer jobs on a server. 
Get-SPTimerJob |format-table -autosize > E:\timerjobslist.txt
Search for “Bamboo Alert Plus Custom Timer Job” in the list to find the complete identity name e.g. “Bamboo Alert Plus Custom Timer Job;#374b5e86-6139-41a3-ad08-35cf4b9c0d99;#3|minutes”
Change the powershell properties width back to 80.  
Plug this identity into the following command to find the Last Run Time, Status and any error messages from the timer job:
Get-SPTimerJob -identity “Bamboo Alert Plus Custom Timer Job;#374b5e86-6139-41a3-ad08-35cf4b9c0d99;#3|minutes” | Format-Table -Property DisplayName,LastRunTime,Status,ErrorMessage 

No comments:

Post a Comment