Export (0) Print
Expand All

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)

public sealed class Service : WmiSmoObject, 
	IAlterable

The Service type exposes the following members.

  NameDescription
Public propertyAcceptsPauseGets the Boolean property value that specifies whether the SQL Server service can be paused.
Public propertyAcceptsStopGets the Boolean property value that specifies whether the SQL Server service can be stopped.
Public propertyAdvancedPropertiesRepresents a collection of Property objects. Each Property object represents an advanced property defined on the SQL Server service.
Public propertyDependenciesReturns a list of services that are dependent on the referenced SQL Server service.
Public propertyDescriptionGets a textual description of the SQL Server service.
Public propertyDisplayNameGets the display name of the SQL Server service.
Public propertyErrorControlGets the severity of the error if the SQL Server service fails to start during startup.
Public propertyExitCodeGets the Win32 error code that defines problems encountered when starting and stopping the SQL Server service.
Public propertyNameGets or sets the name of the referenced Windows Management Instrumentation (WMI) object. (Inherited from WmiSmoObject.)
Public propertyParentGets the ManagedComputer object that is the parent of the Service object.
Public propertyPathNameGets the path and file name of the binary file that implements the SQL Server service.
Public propertyProcessIdGets the process ID that uniquely identifies the SQL Server service.
Public propertyPropertiesRepresents a collection of Property objects. Each Property object represents a property defined on the Windows Management Instrumentation (WMI) object. (Inherited from WmiSmoObject.)
Public propertyServiceAccountGets the system account under which the SQL Server service is running.
Public propertyServiceStateGets the state of the SQL Server service, such as running, stopped, or paused.
Public propertyStartModeGets or sets the method by which the SQL Server service is started.
Public propertyStartupParametersGets or sets any startup parameters for the SQL Server service.
Public propertyStateGets the state of the referenced object. (Inherited from SmoObjectBase.)
Public propertyTypeGets the type of service, such as Microsoft Search service, SQL Server Agent service, or SQL Server service.
Public propertyUrnGets the Uniform Resource Name (URN) address that represents the Windows Management Instrumentation (WMI) object. (Inherited from WmiSmoObject.)
Public propertyUserDataGets or sets user-defined data associated with the referenced object. (Inherited from SmoObjectBase.)
Top

  NameDescription
Public methodAlterUpdates any Service object property changes on an instance of SQL Server.
Protected methodAlterProtocolPropertiesUpdates any protocol object property changes on the Windows Management Instrumentation (WMI) installation. (Inherited from WmiSmoObject.)
Public methodChangePasswordChanges the password for the system account under which the SQL Server service is running.
Protected methodCheckObjectStateChecks the state of the referenced object. (Inherited from WmiSmoObject.)
Protected methodCreateProtocolPropertyCollectionCreates a set of protocol attributes for the referenced object. (Inherited from WmiSmoObject.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Protected methodGetPropertyManagementObjectGets the management object for the specified protocol property. (Inherited from WmiSmoObject.)
Protected methodGetPropertyObjectGets the property from the specified collection with the specified position and value. (Inherited from WmiSmoObject.)
Protected methodGetProtocolPropertyCollectionReturns the protocol property collection for the referenced object. (Inherited from WmiSmoObject.)
Public methodGetType (Inherited from Object.)
Protected methodImplInitializeInitializes the fields of the WmiSmoObjectobject. (Inherited from WmiSmoObject.)
Public methodInitializeInitializes the referenced object. (Inherited from WmiSmoObject.)
Protected methodInvokeMgmtMethod(ManagementObject, String, Object[])Invokes the management method for the referenced object with the specified management object, method name, and parameters. (Inherited from WmiSmoObject.)
Protected methodInvokeMgmtMethod(ManagementObject, ManagementOperationObserver, String, Object[])Invokes the management method for the referenced object with the specified management object, observer, method name, and parameters. (Inherited from WmiSmoObject.)
Protected methodIsObjectInitializedSpecifies whether the referenced object is initialized. (Inherited from WmiSmoObject.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodPausePauses the SQL Server service.
Public methodRefreshRefreshes the SQL Server service. (Overrides WmiSmoObject.Refresh().)
Public methodResumeResumes the SQL Server service.
Protected methodSetNameSets the name of the referenced object. (Inherited from WmiSmoObject.)
Protected methodSetParentImplSets the parent of the referenced object. (Inherited from WmiSmoObject.)
Public methodSetServiceAccountSets the account under which the SQL Server service runs.
Public methodStartStarts the SQL Server service.
Public methodStopStops the SQL Server service.
Public methodToString (Inherited from Object.)
Protected methodUpdateObjectStateUpdates the object state. (Inherited from WmiSmoObject.)
Public methodValidateValidates the state of an object. (Inherited from SmoObjectBase.)
Top

  NameDescription
Public eventManagementStateChangeAn event that occurs when the management state changes.
Top

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

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.

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

Community Additions

ADD
Show:
© 2015 Microsoft