Method to determine account identity of SharePoint 2010 Timer (SPTimerV4) Windows Service
Published 09/07 courtesy of SharePoint SolutionsAs 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;
}
Recent SharePoint Questions
- sharepoint Q&A function
- Customize "Send To" menu in Sharepoint 2007
- Site is opening only on Server but not on other clients. How to fix this?
- Handy & Free of Charge SharePoint Tools
- One Document - two sites
- What is the difference between a document library and a form library?
- What is Collaborative Application Markup Language?
- • What is the difference between SharePoint Portal Server and Windows SharePoint Services?
- Why should you use SharePoint?
- Displaying columns
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…
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
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… 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… 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… For a couple of reasons, Mission: Automation – SharePoint Workflow and InfoPath is one of my favorite classes to teach.Working with the Admin Links on your SharePoint Blog
More Articles Under "Articles"
How to get column names to wrap in #SharePoint new item forms (NewForm.aspx)
The My Links Web Part – It’s Not Just for My Sites #sharepoint
SharePoint Workflow and InfoPath Training… Online! #sharepoint
Most Viewed Content
- Develop Mobile Applications for SharePoint with Mobile Entree - CMSWire
- Bamboos Year in Review: Marc OBrien Introduces the Bamboo Online…
- Working with the Admin Links on your SharePoint Blog
- This Week in Bamboo (June 28th - July 4th, 2009)
- Cisco Plans Office-Like Service, Andreessen Begins a Silicon Valley Venture…

