Класс Service

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

Иерархия наследования

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

Пространство имен:  Microsoft.SqlServer.Management.Smo.Wmi
Сборка:  Microsoft.SqlServer.SqlWmiManagement (в Microsoft.SqlServer.SqlWmiManagement.dll)

Синтаксис

'Декларация
Public NotInheritable Class Service _
    Inherits WmiSmoObject _
    Implements IAlterable
'Применение
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

Тип Service обеспечивает доступ к следующим элементам.

Свойства

  Имя Описание
Открытое свойство AcceptsPause Gets the Boolean property value that specifies whether the SQL Server service can be paused.
Открытое свойство AcceptsStop Gets the Boolean property value that specifies whether the SQL Server service can be stopped.
Открытое свойство AdvancedProperties Represents a collection of Property objects. Each Property object represents an advanced property defined on the SQL Server service.
Открытое свойство Dependencies Returns a list of services that are dependent on the referenced SQL Server service.
Открытое свойство Description Gets a textual description of the SQL Server service.
Открытое свойство DisplayName Gets the display name of the SQL Server service.
Открытое свойство ErrorControl Gets the severity of the error if the SQL Server service fails to start during startup.
Открытое свойство ExitCode Gets the Win32 error code that defines problems encountered when starting and stopping the SQL Server service.
Открытое свойство Name Gets or sets the name of the referenced Windows Management Instrumentation (WMI) object. (Производный от WmiSmoObject.)
Открытое свойство Parent Gets the ManagedComputer object that is the parent of the Service object.
Открытое свойство PathName Gets the path and file name of the binary file that implements the SQL Server service.
Открытое свойство ProcessId Gets the process ID that uniquely identifies the SQL Server service.
Открытое свойство Properties Represents a collection of Property objects. Each Property object represents a property defined on the Windows Management Instrumentation (WMI) object. (Производный от WmiSmoObject.)
Открытое свойство ServiceAccount Gets the system account under which the SQL Server service is running.
Открытое свойство ServiceState Gets the state of the SQL Server service, such as running, stopped, or paused.
Открытое свойство StartMode Gets or sets the method by which the SQL Server service is started.
Открытое свойство StartupParameters Gets or sets any startup parameters for the SQL Server service.
Открытое свойство State Gets the state of the referenced object. (Производный от SmoObjectBase.)
Открытое свойство Type Gets the type of service, such as Microsoft Search service, SQL Server Agent service, or SQL Server service.
Открытое свойство Urn Gets the Uniform Resource Name (URN) address that represents the Windows Management Instrumentation (WMI) object. (Производный от WmiSmoObject.)
Открытое свойство UserData Gets or sets user-defined data associated with the referenced object. (Производный от SmoObjectBase.)

В начало

Методы

  Имя Описание
Открытый метод Alter Updates any Service object property changes on an instance of SQL Server.
Защищенный метод AlterProtocolProperties Updates any protocol object property changes on the Windows Management Instrumentation (WMI) installation. (Производный от WmiSmoObject.)
Открытый метод ChangePassword Changes the password for the system account under which the SQL Server service is running.
Защищенный метод CheckObjectState Checks the state of the referenced object. (Производный от WmiSmoObject.)
Защищенный метод CreateProtocolPropertyCollection Creates a set of protocol attributes for the referenced object. (Производный от WmiSmoObject.)
Открытый метод Equals (Производный от Object.)
Защищенный метод Finalize (Производный от Object.)
Открытый метод GetHashCode (Производный от Object.)
Защищенный метод GetPropertyManagementObject Gets the management object for the specified protocol property. (Производный от WmiSmoObject.)
Защищенный метод GetPropertyObject Gets the property from the specified collection with the specified position and value. (Производный от WmiSmoObject.)
Защищенный метод GetProtocolPropertyCollection Returns the protocol property collection for the referenced object. (Производный от WmiSmoObject.)
Открытый метод GetType (Производный от Object.)
Защищенный метод ImplInitialize Initializes the fields of the WmiSmoObjectobject. (Производный от WmiSmoObject.)
Открытый метод Initialize Initializes the referenced object. (Производный от WmiSmoObject.)
Защищенный метод InvokeMgmtMethod(ManagementObject, String, array<Object> [] () [] []) Invokes the management method for the referenced object with the specified management object, method name, and parameters. (Производный от WmiSmoObject.)
Защищенный метод InvokeMgmtMethod(ManagementObject, ManagementOperationObserver, String, array<Object> [] () [] []) Invokes the management method for the referenced object with the specified management object, observer, method name, and parameters. (Производный от WmiSmoObject.)
Защищенный метод IsObjectInitialized Specifies whether the referenced object is initialized. (Производный от WmiSmoObject.)
Защищенный метод MemberwiseClone (Производный от Object.)
Открытый метод Pause Pauses the SQL Server service.
Открытый метод Refresh Refreshes the SQL Server service. (Переопределяет WmiSmoObject. . :: . .Refresh() () () ().)
Открытый метод Resume Resumes the SQL Server service.
Защищенный метод SetName Sets the name of the referenced object. (Производный от WmiSmoObject.)
Защищенный метод SetParentImpl Sets the parent of the referenced object. (Производный от WmiSmoObject.)
Открытый метод SetServiceAccount Sets the account under which the SQL Server service runs.
Открытый метод Start Starts the SQL Server service.
Открытый метод Stop Stops the SQL Server service.
Открытый метод ToString (Производный от Object.)
Защищенный метод UpdateObjectState Updates the object state. (Производный от WmiSmoObject.)
Открытый метод Validate Validates the state of an object. (Производный от SmoObjectBase.)

В начало

События

  Имя Описание
Открытое событие ManagementStateChange An event that occurs when the management state changes.

В начало

Замечания

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.

Thread Safety

Все общие статические члены этого типа (Shared в Microsoft Visual Basic) можно использовать в многопоточных операциях. Безопасная многопоточная работа с членами экземпляров типа не гарантируется.

Безопасность многопоточности

Любые открытые статический (Shared в Visual Basic) элементы этого типа потокобезопасны. Потокобезопасность с элементами экземпляров не гарантируется.

См. также

Справочник

Другие ресурсы