Share via


Service Class

The Service class represents an instance of the SQL Server service.

Namespace:  Microsoft.SqlServer.Management.Smo.Wmi
Assembly:  Microsoft.SqlServer.SqlWmiManagement (in Microsoft.SqlServer.SqlWmiManagement.dll)

Syntax

'Declaration
Public NotInheritable Class Service _
    Inherits WmiSmoObject _
    Implements IAlterable
'Usage
Dim instance As Service
public sealed class Service : WmiSmoObject, 
    IAlterable
public ref class Service sealed : public WmiSmoObject, 
    IAlterable
[<SealedAttribute>]
type Service =  
    class
        inherit WmiSmoObject
        interface IAlterable
    end
public final class Service extends WmiSmoObject implements IAlterable

Remarks

The Service object is used to programmatically manage the SQL Server service. With the Service object you can:

  • Connect to the service.

  • Modify the account and password used to connect to the service.

  • Start, stop, pause, and resume the service.

  • Check the properties of the service.

To get or set Service object properties or run Service methods, users must be a member of the sysadmin fixed server role.

Thread Safety

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

Inheritance Hierarchy

System.Object
  Microsoft.SqlServer.Management.Smo.SmoObjectBase
    Microsoft.SqlServer.Management.Smo.Wmi.WmiSmoObject
      Microsoft.SqlServer.Management.Smo.Wmi.Service

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.