This documentation is archived and is not being maintained.

ServiceController::Start Method

Starts the service, passing no arguments.

Namespace:  System.ServiceProcess
Assembly:  System.ServiceProcess (in System.ServiceProcess.dll)

void Start()


An error occurred when accessing a system API.


The service was not found.

You cannot call Stop for the service until the service controller status is Running.

The following example uses the ServiceController class to check whether the Alerter service is stopped. If the service is stopped, the example starts the service and waits until the service status is set to Running.

// Check whether the Alerter service is started.
ServiceController^ sc = gcnew ServiceController;
if ( sc )
   sc->ServiceName =  "Alerter";
   Console::WriteLine(  "The Alerter service status is currently set to {0}", sc->Status );
   if ( sc->Status == (ServiceControllerStatus::Stopped) )
      // Start the service if the current status is stopped.
      Console::WriteLine(  "Starting the Alerter service..." );
         // Start the service, and wait until its status is "Running".
         sc->WaitForStatus( ServiceControllerStatus::Running );

         // Display the current service status.
         Console::WriteLine(  "The Alerter service status is now set to {0}.", sc->Status );
      catch ( InvalidOperationException^ e ) 
         Console::WriteLine(  "Could not start the Alerter service." );

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0