SPWindowsServiceInstance Class
Represents an instance of a Windows service that runs on a particular server.
Inheritance Hierarchy
System.Object
Microsoft.SharePoint.Administration.SPAutoSerializingObject
Microsoft.SharePoint.Administration.SPPersistedObject
Microsoft.SharePoint.Administration.SPPersistedUpgradableObject
Microsoft.SharePoint.Administration.SPServiceInstance
Microsoft.SharePoint.Administration.SPWindowsServiceInstance
Microsoft.SharePoint.Administration.SPLoadBalancerServiceInstance
Microsoft.SharePoint.Administration.SPTimerServiceInstance
Microsoft.SharePoint.Administration.SPTracingServiceInstance
Microsoft.SharePoint.Administration.SPUserCodeServiceInstance
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
<GuidAttribute("8BDB8089-6251-4c1e-85FD-8B3C6355C5BA")> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class SPWindowsServiceInstance _
Inherits SPServiceInstance
'Usage
Dim instance As SPWindowsServiceInstance
[GuidAttribute("8BDB8089-6251-4c1e-85FD-8B3C6355C5BA")]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class SPWindowsServiceInstance : SPServiceInstance
Remarks
Retrieve a specific Windows service from either the ServiceInstances or Instances collections.
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. The indexer only works with the name when all of the collection objects are of the same base type. However, a service instance collection will often contain derived classes, so only the GUID can safely be used to retrieve an object. Use the GetValue method of the collection to retrieve a service instance by name.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.