ServiceManager Class

Summary

Responsible for controlling windows services
Assembly
Cake.Services.dll
Namespace
Cake.Services
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IServiceManager"] click Interface0 "/api/Cake.Services/IServiceManager" Type["ServiceManager"] class Type type-node

Syntax

public class ServiceManager : IServiceManager

Constructors

Name Summary
ServiceManager(ICakeEnvironment, ICakeLog, IPowershellRunner) Initializes a new instance of the ServiceManager class.

Methods

Name Value Summary
CanPauseAndContinue(string, string) bool
Checks if the named service can be paused and continued
CanShutdown(string, string) bool
Checks if the named service can be shutdown
CanStop(string, string) bool
Checks if the named service can be stopped
Continue(string, string, int) bool
Continues a named service
CreateInstallArguments(string, InstallSettings) ProcessArgumentBuilder
Assemble the args to pass to sc.exe
ExecuteCommand(string, string, int) bool
Executes a command on a named service
GetService(string, string) ServiceController
Gets the System.ServiceProcess.ServiceController that is associated with an existing service on the specified computer.
GetServices(string) List<ServiceController>
Gets a list of System.ServiceProcess.ServiceController on the specified computer.
GetStatus(string, string) ServiceControllerStatus
Gets the System.ServiceProcess.ServiceControllerStatus status of a service on the specified computer.
Install(InstallSettings) void
Installs a service on a computer
Install(string, InstallSettings) void
Installs a service on a computer
IsContinuing(string, string) bool
Checks if the named service is continuing
IsInstalled(string, string) bool
Checks if the named service is installed
IsPaused(string, string) bool
Checks if the named service is paused
IsPausing(string, string) bool
Checks if the named service is pausing
IsRunning(string, string) bool
Checks if the named service is running
IsStarting(string, string) bool
Checks if the named service is starting
IsStopped(string, string) bool
Checks if the named service is stopped
IsStopping(string, string) bool
Checks if the named service is stopping
Pause(string, string, int) bool
Pauses a named service
Restart(string, string, int) bool
Restarts a named service
ServiceExists(string, string) bool
Checks if the named service exists
Start(string, string, int, string[]) bool
Starts a named service
Stop(string, string, int) bool
Stops a named service
Uninstall(string, string) bool
Uninstalls a service from a computer

Extension Methods

Name Value Summary
Dump<ServiceManager>() string
Get a basic string representation of specified object.
Requires the Cake.Incubator addin
IsIn<ServiceManager>(ServiceManager[]) bool
Checks if the source is contained in a list
Requires the Cake.Incubator addin
NotNull<ServiceManager>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Ftp addin
NotNull<ServiceManager>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Issues addin
ThrowIfNull<ServiceManager>(string) T
Throws a System.ArgumentNullException if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ThrowIfNull<ServiceManager>(string, string) T
Throws a System.ArgumentNullException with a specific message if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ToDictionary() IDictionary<string, object>
Requires the Cake.DeployParams addin