Export (0) Print
Expand All

ServiceController.ExecuteCommand Method

Executes a custom command on the service.

[Visual Basic]
Public Sub ExecuteCommand( _
   ByVal command As Integer _
)
[C#]
public void ExecuteCommand(
 int command
);
[C++]
public: void ExecuteCommand(
 int command
);
[JScript]
public function ExecuteCommand(
   command : int
);

Parameters

command
An application-defined command flag that indicates which custom command to execute.

Exceptions

Exception Type Condition
Win32Exception An error occurred when accessing a system API.
InvalidOperationException The service cannot handle the custom command.

Remarks

When you call ExecuteCommand, the status of the service does not change. If the service was started, the status remains Running. If the service was stopped, the status remains Stopped, and so on.

Requirements

Platforms: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ServiceController Class | ServiceController Members | System.ServiceProcess Namespace

Show:
© 2014 Microsoft