Export (0) Print
Expand All

SPWindowsServiceInstance Class

Windows SharePoint Services 3

Represents an instance of a Windows service that runs on a particular server.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class SPWindowsServiceInstance : SPServiceInstance

To return a specific Windows service, use the SPWindowsServiceInstance constructor.

Use the inherited Instances property of the SPWindowsService class to return an SPServiceInstanceDependencyCollection object that represents all instances of the Windows service. Use the SPWindowsServiceInstanceCollection constructor to return the collection of Windows service instances that are currently running on a specific server.

Use an indexer to return a single Windows service instance from the collection. For example, if the collection is assigned to a variable named myWindowsServiceInstances, use myWindowsServiceInstances[index] in C#, or myWindowsServiceInstances(index) in Visual Basic, where index is either the name or the GUID that identifies the Windows service instance.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

© 2014 Microsoft