API Reference
Class
ServicesControl
Helper methods for starting, stopping, restarting services, and changing startup type on a target machine.
Inheritance
- Object
- ServicesControl
Methods
public static Boolean Restart(String computer, String serviceName, Nullable<TimeSpan> timeout = null) #Returns:
BooleanRestarts the specified service (stop then start).
Parameters
- computer System.String
- Target computer; empty for local.
- serviceName System.String
- Service name.
- timeout System.Nullable{System.TimeSpan} = null
- Optional per‑transition timeout.
Returns
True when restart succeeds.
public static Boolean SetStartupType(String computer, String serviceName, ServiceStartupType type) #Returns:
BooleanSets the startup type using the Win32_Service.ChangeStartMode WMI method.
Parameters
- computer System.String
- Target computer; empty for local.
- serviceName System.String
- Service name.
- type ComputerX.Services.ServiceStartupType
- Desired startup type.
Returns
True when the change succeeds.
public static Boolean Start(String computer, String serviceName, Nullable<TimeSpan> timeout = null) #Returns:
BooleanStarts the specified service.
Parameters
- computer System.String
- Target computer; empty for local.
- serviceName System.String
- Service name.
- timeout System.Nullable{System.TimeSpan} = null
- Optional timeout to wait for Running.
Returns
True when start succeeds.
public static Boolean Stop(String computer, String serviceName, Nullable<TimeSpan> timeout = null) #Returns:
BooleanStops the specified service.
Parameters
- computer System.String
- Target computer; empty for local.
- serviceName System.String
- Service name.
- timeout System.Nullable{System.TimeSpan} = null
- Optional timeout to wait for Stopped.
Returns
True when stop succeeds.
Inherited Methods
public override Boolean Equals(Object obj) #Returns:
BooleanInherited from Object
Parameters
- obj Object