Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SPWindowsServiceInstance class

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

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
[GuidAttribute("8BDB8089-6251-4c1e-85FD-8B3C6355C5BA")]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class SPWindowsServiceInstance : SPServiceInstance

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.