Metalogix SharePoint Site Migration Manager

Method to determine account identity of SharePoint 2010 Timer (SPTimerV4) Windows Service

Published 09/07 courtesy of SharePoint Solutions

As a developer of solutions for the SharePoint 2010 platform, you may on occasion find the need to determine the account identity of the SharePoint 2010 Timer Windows Service (SPTimerV4). The following method will return the services account name for you.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20private static string GetSPTimerJobAccountName()
{
string retval = null;
ServiceController[] controllers = ServiceController.GetServices();
var cont = controllers.Where(c => c.ServiceName == SPTimerV4);
ServiceController svc = cont.FirstOrDefault();
if (svc != null)
{
System.Management.SelectQuery query = new System.Management.SelectQuery(string.Format(select name, startname from Win32_Service where name = {0}, svc.ServiceName));
using (System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher(query))
{
foreach (System.Management.ManagementObject service in searcher.Get())
{
retval = service[startname] as string;
}
}
}

return retval;
}

Read more



Recent SharePoint Questions

more sharepoint questions


More Articles By

Develop Mobile Applications for SharePoint with Mobile Entree - CMSWire


Develop Mobile Applications for SharePoint with Mobile Entree
CMSWire, CA
By Barb Mosher | Jun 5, 2009 Seeing as how SharePoint (news, site) is so widely used within the enterprise today, it's…

Read more

Bamboos Year in Review: Marc OBrien Introduces the Bamboo Online Applications Division

Editor's note:  Last year we introduced the Bamboo Year in Review feature, kicking off with a note

Read more

Working with the Admin Links on your SharePoint Blog

While writing the final sentences of my post on how to create a SharePoint blog last week, I realized that I needed to circle back and spend some time…

Read more

More Articles Under "Articles"

How to get column names to wrap in #SharePoint new item forms (NewForm.aspx)

I was asked the other day if there might be a slick CSS method for getting long column names to wrap in a SharePoint list’s new item form (NewForm.aspx). The…

Read more

The My Links Web Part – It’s Not Just for My Sites #sharepoint

I’ve talked to a number of folks in recent months that have wanted to add the links stored in a user’s My Links list in their My Site to other…

Read more

SharePoint Workflow and InfoPath Training… Online! #sharepoint

For a couple of reasons, Mission: Automation – SharePoint Workflow and InfoPath is one of my favorite classes to teach.

  1. The student feedback is incredible. Everything in this class is…

    Read more



    Metalogix SharePoint Site Migration Manager