The Service class represents an instance of the SQL Server service.
The following tables list the members exposed by the Service type.
Public Properties
| 名称 | Description | |
|---|---|---|
| .gif) | AcceptsPause | Gets the Boolean property value that specifies whether the SQL Server service can be paused. | 
| .gif) | AcceptsStop | Gets the Boolean property value that specifies whether the SQL Server service can be stopped. | 
| .gif) | AdvancedProperties | Represents a collection of Property objects. Each Property object represents an advanced property defined on the SQL Server service. | 
| .gif) | Dependencies | Returns a list of services that are dependent on the referenced SQL Server service. | 
| .gif) | Description | Gets a textual description of the SQL Server service. | 
| .gif) | DisplayName | Gets the display name of the SQL Server service. | 
| .gif) | ErrorControl | Gets the severity of the error if the SQL Server service fails to start during startup. | 
| .gif) | ExitCode | Gets the Win32 error code that defines problems encountered when starting and stopping the SQL Server service. | 
| .gif) | Name | Gets or sets the name of the referenced Windows Management Instrumentation (WMI) object. (inherited from WmiSmoObject) | 
| .gif) | Parent | Gets the ManagedComputer object that is the parent of the Service object. | 
| .gif) | PathName | Gets the path and file name of the binary file that implements the SQL Server service. | 
| .gif) | ProcessId | Gets the process ID that uniquely identifies the SQL Server service. | 
| .gif) | Properties | Represents a collection of Property objects. Each Property object represents a property defined on the Windows Management Instrumentation (WMI) object. (inherited from WmiSmoObject) | 
| .gif) | ServiceAccount | Gets the system account under which the SQL Server service is running. | 
| .gif) | ServiceState | Gets the state of the SQL Server service, such as running, stopped, or paused. | 
| .gif) | StartMode | Gets or sets the method by which the SQL Server service is started. | 
| .gif) | StartupParameters | Gets or sets any startup parameters for the SQL Server service. | 
| .gif) | State | Gets the state of the referenced object. (inherited from SmoObjectBase) | 
| .gif) | Type | Gets the type of service, such as Microsoft Search service, SQL Server Agent service, or SQL Server service. | 
| .gif) | Urn | Gets the Uniform Resource Name (URN) address that represents the Windows Management Instrumentation (WMI) object. (inherited from WmiSmoObject) | 
| .gif) | UserData | Gets or sets user-defined data associated with the referenced object. (inherited from SmoObjectBase) | 
顶部
Public Methods
(see also Protected Methods )
| 名称 | Description | |
|---|---|---|
| .gif) | Alter | Updates any Service object property changes on an instance of SQL Server. | 
| .gif) | ChangePassword | Changes the password for the system account under which the SQL Server service is running. | 
| .gif) | Equals | Overloaded. (inherited from Object ) | 
| .gif) | GetHashCode | (inherited from Object ) | 
| .gif) | GetType | (inherited from Object ) | 
| .gif) | Initialize | Initializes the referenced object. (inherited from WmiSmoObject) | 
| .gif) | Pause | Pauses the SQL Server service. | 
| .gif) .gif) | ReferenceEquals | (inherited from Object ) | 
| .gif) | Refresh | Overridden. Refreshes the SQL Server service. | 
| .gif) | Resume | Resumes the SQL Server service. | 
| .gif) | SetServiceAccount | Sets the account under which the SQL Server service runs. | 
| .gif) | Start | Starts the SQL Server service. | 
| .gif) | Stop | Stops the SQL Server service. | 
| .gif) | ToString | (inherited from Object ) | 
顶部
Protected Methods
| 名称 | Description | |
|---|---|---|
| .gif) | AlterProtocolProperties | (inherited from WmiSmoObject ) | 
| .gif) | CheckObjectState | Checks the state of the referenced object. (inherited from WmiSmoObject) | 
| .gif) | CreateProtocolPropertyCollection | Creates a set of protocol attributes for the referenced object. (inherited from WmiSmoObject) | 
| .gif) | Finalize | (inherited from Object ) | 
| .gif) | GetPropertyManagementObject | (inherited from WmiSmoObject ) | 
| .gif) | GetPropertyObject | (inherited from WmiSmoObject ) | 
| .gif) | GetProtocolPropertyCollection | Returns the protocol property collection for the referenced object. (inherited from WmiSmoObject) | 
| .gif) | ImplInitialize | (inherited from WmiSmoObject ) | 
| .gif) | InvokeMgmtMethod | Overloaded. (inherited from WmiSmoObject ) | 
| .gif) | IsObjectInitialized | Specifies whether the referenced object is initialized. (inherited from WmiSmoObject) | 
| .gif) | MemberwiseClone | (inherited from Object ) | 
| .gif) | SetName | (inherited from WmiSmoObject ) | 
| .gif) | SetParentImpl | (inherited from WmiSmoObject ) | 
| .gif) .gif) | Trace | (inherited from WmiSmoObject ) | 
| .gif) | UpdateObjectState | Updates the object state. (inherited from WmiSmoObject) | 
顶部
Public Events
| 名称 | Description | |
|---|---|---|
| .gif) | ManagementStateChange | An event that occurs when the management state changes. | 
顶部
请参阅
参考
Service Class
Microsoft.SqlServer.Management.Smo.Wmi Namespace
其他资源
Managing Services and Network Settings by Using WMI Provider
WMI and SQL Server
连接到 SQL Server 数据库引擎