TestimoX

API Reference

Class

ServicesControl

Namespace ComputerX.Services
Assembly ComputerX
Modifiers static
Attributes
SupportedOSPlatform("windows")

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: Boolean

Restarts the specified service (stop then start).

Parameters

computer System.String requiredposition: 0
Target computer; empty for local.
serviceName System.String requiredposition: 1
Service name.
timeout System.Nullable{System.TimeSpan} = null optionalposition: 2
Optional per‑transition timeout.

Returns

True when restart succeeds.

public static Boolean SetStartupType(String computer, String serviceName, ServiceStartupType type) #
Returns: Boolean

Sets the startup type using the Win32_Service.ChangeStartMode WMI method.

Parameters

computer System.String requiredposition: 0
Target computer; empty for local.
serviceName System.String requiredposition: 1
Service name.
type ComputerX.Services.ServiceStartupType requiredposition: 2
Desired startup type.

Returns

True when the change succeeds.

public static Boolean Start(String computer, String serviceName, Nullable<TimeSpan> timeout = null) #
Returns: Boolean

Starts the specified service.

Parameters

computer System.String requiredposition: 0
Target computer; empty for local.
serviceName System.String requiredposition: 1
Service name.
timeout System.Nullable{System.TimeSpan} = null optionalposition: 2
Optional timeout to wait for Running.

Returns

True when start succeeds.

public static Boolean Stop(String computer, String serviceName, Nullable<TimeSpan> timeout = null) #
Returns: Boolean

Stops the specified service.

Parameters

computer System.String requiredposition: 0
Target computer; empty for local.
serviceName System.String requiredposition: 1
Service name.
timeout System.Nullable{System.TimeSpan} = null optionalposition: 2
Optional timeout to wait for Stopped.

Returns

True when stop succeeds.