SPWindowsServiceInstanceCollection Class

Represents a collection of SPWindowsServiceInstance objects.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPPersistedObjectCollection<SPWindowsServiceInstance>
    Microsoft.SharePoint.Administration.SPPersistedChildCollection<SPWindowsServiceInstance>
      Microsoft.SharePoint.Administration.SPWindowsServiceInstanceCollection

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPWindowsServiceInstanceCollection _
    Inherits SPPersistedChildCollection(Of SPWindowsServiceInstance)
'Usage
Dim instance As SPWindowsServiceInstanceCollection
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPWindowsServiceInstanceCollection : SPPersistedChildCollection<SPWindowsServiceInstance>

Remarks

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 running on a specific server. To add a Windows service instance to the collection, use the Add method.

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 identifying 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

SPWindowsServiceInstanceCollection Members

Microsoft.SharePoint.Administration Namespace