C# Class DNSManagement.Service

ファイルを表示 Open project: drorgl/MSDNSWebAdmin Class Usage Examples

Public Methods

Method Description
Change ( string displayName, string pathName, ServiceTypeEnum serviceType, ErrorControlEnum errorControl, StartModeEnum startMode, bool desktopInteract, string startName, string startPassword, string loadOrderGroup, string loadOrderGroupDependencies, string serviceDependencies ) : ServiceManager.MethodExecutionResultEnum

Modifies a service

ChangeStartMode ( StartModeEnum startMode ) : ServiceManager.MethodExecutionResultEnum

modifies the start mode of a service.

Delete ( ) : ServiceManager.MethodExecutionResultEnum

deletes a service.

GetSecurityDescriptor ( object &descriptor ) : ServiceManager.MethodExecutionResultEnum

returns the security descriptor that controls access to the service

InterrogateService ( ) : ServiceManager.MethodExecutionResultEnum

requests that the referenced service update its state to the service manager.

PauseService ( ) : ServiceManager.MethodExecutionResultEnum

attempts to place the service in the paused state

ResumeService ( ) : ServiceManager.MethodExecutionResultEnum

attempts to place the referenced service in the resumed state

SetSecurityDescriptor ( object descriptor ) : ServiceManager.MethodExecutionResultEnum

writes an updated version of the security descriptor that controls access to the service.

StartService ( ) : ServiceManager.MethodExecutionResultEnum

attempts to place the referenced service into its startup state

StopService ( ) : ServiceManager.MethodExecutionResultEnum

attempts to place the referenced service into its stopped state

ToString ( ) : string
UserControlService ( byte controlCode ) : ServiceManager.MethodExecutionResultEnum

attempts to send a user-defined control code to the referenced service.

Private Methods

Method Description
Service ( System.Management.ManagementObject mo ) : System

Method Details

Change() public method

Modifies a service
public Change ( string displayName, string pathName, ServiceTypeEnum serviceType, ErrorControlEnum errorControl, StartModeEnum startMode, bool desktopInteract, string startName, string startPassword, string loadOrderGroup, string loadOrderGroupDependencies, string serviceDependencies ) : ServiceManager.MethodExecutionResultEnum
displayName string The display name of the service. This string has a maximum length of 256 characters. The name is case-preserved in the service control manager. DisplayName comparisons are always case-insensitive.
pathName string The fully-qualified path to the executable file that implements the service, for example, "\SystemRoot\System32\drivers\afd.sys".
serviceType ServiceTypeEnum The type of services provided to processes that call them.
errorControl ErrorControlEnum Severity of the error if this service fails to start during startup. The value indicates the action taken by the startup program if failure occurs. All errors are logged by the system.
startMode StartModeEnum Start mode of the Windows base service.
desktopInteract bool If true, the service can create or communicate with a window on the desktop.
startName string Account name the service runs under. Depending on the service type, the account name may be in the form of DomainName\Username or .\Username. The service process will be logged using one of these two forms when it runs. If the account belongs to the built-in domain, .\Username can be specified. If NULL is specified, the service will be logged on as the LocalSystem account. For kernel or system-level drivers, StartName contains the driver object name (that is, \FileSystem\Rdr or \Driver\Xns) that the input and output (I/O) system uses to load the device driver. If NULL is specified, the driver runs with a default object name created by the I/O system based on the service name, for example, "DWDOM\Admin". You also can use the User Principal Name (UPN) format to specify the StartName, for example, Username@DomainName.
startPassword string Password to the account name specified by the StartName parameter. Specify NULL if you are not changing the password. Specify an empty string if the service has no password. Note When changing a service from a local system to a network, or from a network to a local system, StartPassword must be an empty string ("") and not NULL.
loadOrderGroup string Group name that it is associated with. Load order groups are contained in the system registry, and determine the sequence in which services are loaded into the operating system. If the pointer is NULL, or if it points to an empty string, the service does not belong to a group. Dependencies between groups should be listed in the LoadOrderGroupDependencies parameter. Services in the load-ordering group list are started first, followed by services in groups not in the load-ordering group list, followed by services that do not belong to a group. The system registry has a list of load ordering groups located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ServiceGroupOrder.
loadOrderGroupDependencies string List of load-ordering groups that must start before this service starts. The array is doubly null-terminated. If the pointer is NULL, or if it points to an empty string, the service has no dependencies. Group names must be prefixed by the SC_GROUP_IDENTIFIER (defined in the Winsvc.h file) character to differentiate them from service names because services and service groups share the same namespace. Dependency on a group means that this service can run if at least one member of the group is running after an attempt to start all of the members of the group.
serviceDependencies string List that contains the names of services that must start before this service starts. The array is doubly NULL-terminated. If the pointer is NULL, or if it points to an empty string, the service has no dependencies. Dependency on a service indicates that this service can run only if the service it depends on is running.
return ServiceManager.MethodExecutionResultEnum

ChangeStartMode() public method

modifies the start mode of a service.
public ChangeStartMode ( StartModeEnum startMode ) : ServiceManager.MethodExecutionResultEnum
startMode StartModeEnum Start mode of the Windows base service.
return ServiceManager.MethodExecutionResultEnum

Delete() public method

deletes a service.
public Delete ( ) : ServiceManager.MethodExecutionResultEnum
return ServiceManager.MethodExecutionResultEnum

GetSecurityDescriptor() public method

returns the security descriptor that controls access to the service
public GetSecurityDescriptor ( object &descriptor ) : ServiceManager.MethodExecutionResultEnum
descriptor object
return ServiceManager.MethodExecutionResultEnum

InterrogateService() public method

requests that the referenced service update its state to the service manager.
public InterrogateService ( ) : ServiceManager.MethodExecutionResultEnum
return ServiceManager.MethodExecutionResultEnum

PauseService() public method

attempts to place the service in the paused state
public PauseService ( ) : ServiceManager.MethodExecutionResultEnum
return ServiceManager.MethodExecutionResultEnum

ResumeService() public method

attempts to place the referenced service in the resumed state
public ResumeService ( ) : ServiceManager.MethodExecutionResultEnum
return ServiceManager.MethodExecutionResultEnum

SetSecurityDescriptor() public method

writes an updated version of the security descriptor that controls access to the service.
public SetSecurityDescriptor ( object descriptor ) : ServiceManager.MethodExecutionResultEnum
descriptor object
return ServiceManager.MethodExecutionResultEnum

StartService() public method

attempts to place the referenced service into its startup state
public StartService ( ) : ServiceManager.MethodExecutionResultEnum
return ServiceManager.MethodExecutionResultEnum

StopService() public method

attempts to place the referenced service into its stopped state
public StopService ( ) : ServiceManager.MethodExecutionResultEnum
return ServiceManager.MethodExecutionResultEnum

ToString() public method

public ToString ( ) : string
return string

UserControlService() public method

attempts to send a user-defined control code to the referenced service.
public UserControlService ( byte controlCode ) : ServiceManager.MethodExecutionResultEnum
controlCode byte Specifies defined values (from 128 to 255) that provide control commands specific to a user.
return ServiceManager.MethodExecutionResultEnum