PeanutButter
Loading...
Searching...
No Matches
PeanutButter.WindowsServiceManagement.IWindowsServiceUtil Interface Reference

The Windows Service Utility contract. More...

Inheritance diagram for PeanutButter.WindowsServiceManagement.IWindowsServiceUtil:
PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil PeanutButter.WindowsServiceManagement.WindowsServiceUtil

Public Member Functions

void Start ()
 Start the service and wait for it to be running.
void Start (bool wait)
 Start the service Explicitly wait or not for it to start.
void Stop ()
 Stop the service and wait for it to be running.
void Stop (bool wait)
 Start the service Explicitly wait or not for it to stop.
void Stop (ControlOptions options)
 Stop the service with the provided control options.
void Pause ()
 Pause the service, waiting for it to enter the paused state.
void Pause (bool wait)
 Pause the service Explicitly wait or not for it to pause.
void Continue ()
 Continue the service, waiting for it to enter the continued state.
void Continue (bool wait)
 Continue the service Explicitly wait or not for it to continue.
void ConfigureStartup (ServiceStartupTypes startupType)
 Configure the service's startup type.
void Install ()
 Installs the service with automatic start. Will error if the service is already found by name.
void Install (ServiceStartupTypes startupType)
 Install with the provided startup type.
void Uninstall ()
 Uninstalls the service. If the service is not found by name, does nothing.
void Uninstall (bool wait)
 Uninstalls the service. If the service is not found by name, does nothing. Will wait for the uninstallation to complete.
void Uninstall (ControlOptions options)
 More control over uninstallation.
void InstallAndStart ()
 Installs the service as AutoStart and starts it, waiting for the service to report that it's running.
void InstallAndStart (bool wait)
 Install and start the service as AutoStarting, with control over whether to wait for the service to have properly started.
void InstallAndStart (ServiceStartupTypes startupType, bool wait)
 Install and start the service, with control over whether to wait for the service to have properly started.
void Disable ()
 Disable the service from running.
void SetAutomaticStart ()
 Set the service to automatically start with the host system.
void SetManualStart ()
 Set the service to require manual start.
KillServiceResult KillService ()
 Kills the service, if running.

Properties

string ServiceName [get]
 The name of the service, usable from, eg 'net stop {name}'.
string DisplayName [get]
 The name displayed in the service manager (service.msc)
string ServiceExe [get]
 The path to the service executable.
string[] Arguments [get]
 The arguments that the service is started with.
string Commandline [get]
 The full commandline for this service.
ServiceState State [get]
 The current state of this service.
ServiceStartupTypes StartupType [get]
 The startup type of the service.
bool IsDisabled [get]
 Whether or not the service is disabled -> this is a shortcut to check the startup type vs the disabled startup type.
bool IsInstalled [get]
 Whether or not the service is installed -> this is a shortcut to check startup type vs unknown.
bool IsRunning [get]
 Whether or not the service is running.
bool IsPaused [get]
 Whether or not the service is paused.
bool IsMarkedForDelete [get]
 Test if the service is marked for deletion.
bool IsStoppable [get]
 True if the service is in a stoppable state.
bool IsStartable [get]
 True if the service is in a startable state.
int ServicePID [get]
 The process id for a running process (0 when not running)

Detailed Description

The Windows Service Utility contract.

Member Function Documentation

◆ ConfigureStartup()

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.ConfigureStartup ( ServiceStartupTypes startupType)

Configure the service's startup type.

Parameters
startupType

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ Continue() [1/2]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Continue ( )

Continue the service, waiting for it to enter the continued state.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ Continue() [2/2]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Continue ( bool wait)

Continue the service Explicitly wait or not for it to continue.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ Disable()

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Disable ( )

◆ Install() [1/2]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Install ( )

Installs the service with automatic start. Will error if the service is already found by name.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ Install() [2/2]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Install ( ServiceStartupTypes startupType)

Install with the provided startup type.

Parameters
startupType

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ InstallAndStart() [1/3]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.InstallAndStart ( )

Installs the service as AutoStart and starts it, waiting for the service to report that it's running.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ InstallAndStart() [2/3]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.InstallAndStart ( bool wait)

Install and start the service as AutoStarting, with control over whether to wait for the service to have properly started.

Parameters
wait

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ InstallAndStart() [3/3]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.InstallAndStart ( ServiceStartupTypes startupType,
bool wait )

Install and start the service, with control over whether to wait for the service to have properly started.

Parameters
startupType
wait

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ KillService()

KillServiceResult PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.KillService ( )

◆ Pause() [1/2]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Pause ( )

Pause the service, waiting for it to enter the paused state.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ Pause() [2/2]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Pause ( bool wait)

Pause the service Explicitly wait or not for it to pause.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ SetAutomaticStart()

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.SetAutomaticStart ( )

Set the service to automatically start with the host system.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ SetManualStart()

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.SetManualStart ( )

◆ Start() [1/2]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Start ( )

◆ Start() [2/2]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Start ( bool wait)

Start the service Explicitly wait or not for it to start.

Parameters
wait

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ Stop() [1/3]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Stop ( )

◆ Stop() [2/3]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Stop ( bool wait)

Start the service Explicitly wait or not for it to stop.

Parameters
wait

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ Stop() [3/3]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Stop ( ControlOptions options)

Stop the service with the provided control options.

  • when Force is provided, if the service doesn't stop within the allowed period, it will be killed.
Parameters
options

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ Uninstall() [1/3]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Uninstall ( )

Uninstalls the service. If the service is not found by name, does nothing.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ Uninstall() [2/3]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Uninstall ( bool wait)

Uninstalls the service. If the service is not found by name, does nothing. Will wait for the uninstallation to complete.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ Uninstall() [3/3]

void PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Uninstall ( ControlOptions options)

Property Documentation

◆ Arguments

string [] PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Arguments
get

◆ Commandline

string PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.Commandline
get

◆ DisplayName

string PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.DisplayName
get

The name displayed in the service manager (service.msc)

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ IsDisabled

bool PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.IsDisabled
get

Whether or not the service is disabled -> this is a shortcut to check the startup type vs the disabled startup type.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ IsInstalled

bool PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.IsInstalled
get

Whether or not the service is installed -> this is a shortcut to check startup type vs unknown.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ IsMarkedForDelete

bool PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.IsMarkedForDelete
get

◆ IsPaused

bool PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.IsPaused
get

Whether or not the service is paused.

  • always false for an uninstalled service

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ IsRunning

bool PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.IsRunning
get

Whether or not the service is running.

  • always false for an uninstalled service

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ IsStartable

bool PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.IsStartable
get

◆ IsStoppable

bool PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.IsStoppable
get

◆ ServiceExe

string PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.ServiceExe
get

◆ ServiceName

string PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.ServiceName
get

The name of the service, usable from, eg 'net stop {name}'.

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ ServicePID

int PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.ServicePID
get

The process id for a running process (0 when not running)

Implemented in PeanutButter.WindowsServiceManagement.NativeWindowsServiceUtil, and PeanutButter.WindowsServiceManagement.WindowsServiceUtil.

◆ StartupType

ServiceStartupTypes PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.StartupType
get

◆ State

ServiceState PeanutButter.WindowsServiceManagement.IWindowsServiceUtil.State
get

The documentation for this interface was generated from the following file:
  • source/Win32Service/PeanutButter.WindowsServiceManagement/WindowsServiceUtil.cs