Partager via


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.Search.Administration.SPSearchServiceInstance

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

Syntax

<GuidAttribute("8BDB8089-6251-4c1e-85FD-8B3C6355C5BA")> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class SPWindowsServiceInstance _
    Inherits SPServiceInstance

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

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.

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.

See Also

Reference

SPWindowsServiceInstance Members

Microsoft.SharePoint.Administration Namespace