API Reference
WindowsServiceManager
Local Windows service lifecycle helpers for install, uninstall, status, and start/stop operations.
Inheritance
- Object
- WindowsServiceManager
Methods
public static Void BackupCommandLine(String serviceName, String backupPath) #VoidBacks up the current SCM binary path for a local Windows service to a file on the current machine.
Parameters
- serviceName System.String
- backupPath System.String
public static Void BackupCommandLine(String machineName, String serviceName, String backupPath) #VoidBacks up the current SCM binary path for a Windows service to a file on the current machine.
Parameters
- machineName System.String
- serviceName System.String
- backupPath System.String
public static WindowsServiceStatusSnapshot EnsureInstalled(WindowsServiceInstallRequest request) #WindowsServiceStatusSnapshotCreates a Windows service when missing or updates it when already installed.
Parameters
- request ComputerX.Services.WindowsServiceInstallRequest
public static WindowsServiceStatusSnapshot EnsureInstalled(String machineName, WindowsServiceInstallRequest request) #WindowsServiceStatusSnapshotCreates a Windows service on the specified computer when missing or updates it when already installed.
Parameters
- machineName System.String
- request ComputerX.Services.WindowsServiceInstallRequest
public static WindowsServiceCommandLine GetCommandLine(String serviceName) #WindowsServiceCommandLineReturns the parsed SCM binary path for a local Windows service.
Parameters
- serviceName System.String
public static WindowsServiceCommandLine GetCommandLine(String machineName, String serviceName) #WindowsServiceCommandLineReturns the parsed SCM binary path for a Windows service on the specified computer.
Parameters
- machineName System.String
- serviceName System.String
public static WindowsServiceConfigurationSnapshot GetConfiguration(String serviceName) #WindowsServiceConfigurationSnapshotReturns the current Service Control Manager configuration for a local Windows service.
Parameters
- serviceName System.String
public static WindowsServiceConfigurationSnapshot GetConfiguration(String machineName, String serviceName) #WindowsServiceConfigurationSnapshotReturns the current Service Control Manager configuration for a Windows service on the specified computer.
Parameters
- machineName System.String
- serviceName System.String
public static WindowsServiceStatusSnapshot GetStatus(String serviceName) #WindowsServiceStatusSnapshotReturns the current status snapshot for a local Windows service.
Parameters
- serviceName System.String
public static WindowsServiceStatusSnapshot GetStatus(String machineName, String serviceName) #WindowsServiceStatusSnapshotReturns the current status snapshot for a Windows service on the specified computer.
Parameters
- machineName System.String
- serviceName System.String
public static WindowsServiceStatusSnapshot Install(WindowsServiceInstallRequest request) #WindowsServiceStatusSnapshotCreates a Windows service and optionally starts it.
Parameters
- request ComputerX.Services.WindowsServiceInstallRequest
public static WindowsServiceStatusSnapshot Install(String machineName, WindowsServiceInstallRequest request) #WindowsServiceStatusSnapshotCreates a Windows service on the specified computer and optionally starts it.
Parameters
- machineName System.String
- request ComputerX.Services.WindowsServiceInstallRequest
public static WindowsServiceStatusSnapshot Restart(String serviceName, Nullable<TimeSpan> timeout = null) #WindowsServiceStatusSnapshotRestarts an installed Windows service.
Parameters
- serviceName System.String
- timeout System.Nullable{System.TimeSpan} = null
public static WindowsServiceStatusSnapshot Restart(String machineName, String serviceName, Nullable<TimeSpan> timeout = null) #WindowsServiceStatusSnapshotRestarts an installed Windows service on the specified computer.
Parameters
- machineName System.String
- serviceName System.String
- timeout System.Nullable{System.TimeSpan} = null
public static Boolean RestoreCommandLine(String serviceName, String backupPath, String executablePathOverride = null, Boolean deleteBackupFile = true) #BooleanRestores the SCM binary path for a local Windows service from a backup file on the current machine.
Parameters
- serviceName System.String
- backupPath System.String
- executablePathOverride System.String = null
- deleteBackupFile System.Boolean = true
public static Boolean RestoreCommandLine(String machineName, String serviceName, String backupPath, String executablePathOverride, Boolean deleteBackupFile) #BooleanRestores the SCM binary path for a Windows service from a backup file on the current machine.
Parameters
- machineName System.String
- serviceName System.String
- backupPath System.String
- executablePathOverride System.String
- deleteBackupFile System.Boolean
public static WindowsServiceStatusSnapshot Start(String serviceName, Nullable<TimeSpan> timeout = null) #WindowsServiceStatusSnapshotStarts an installed Windows service.
Parameters
- serviceName System.String
- timeout System.Nullable{System.TimeSpan} = null
public static WindowsServiceStatusSnapshot Start(String machineName, String serviceName, Nullable<TimeSpan> timeout = null) #WindowsServiceStatusSnapshotStarts an installed Windows service on the specified computer.
Parameters
- machineName System.String
- serviceName System.String
- timeout System.Nullable{System.TimeSpan} = null
public static WindowsServiceStatusSnapshot Stop(String serviceName, Nullable<TimeSpan> timeout = null) #WindowsServiceStatusSnapshotStops an installed Windows service.
Parameters
- serviceName System.String
- timeout System.Nullable{System.TimeSpan} = null
public static WindowsServiceStatusSnapshot Stop(String machineName, String serviceName, Nullable<TimeSpan> timeout = null) #WindowsServiceStatusSnapshotStops an installed Windows service on the specified computer.
Parameters
- machineName System.String
- serviceName System.String
- timeout System.Nullable{System.TimeSpan} = null
public static Boolean TryPrepareCommandLine(String persistedValue, String executablePath, IEnumerable<String> requiredOptions, IEnumerable<KeyValuePair<String, String>> optionOverrides, out WindowsServiceCommandLine commandLine) #BooleanTries to prepare a rebased command line from a persisted service binary path and optional option overrides.
Parameters
- persistedValue System.String
- executablePath System.String
- requiredOptions System.Collections.Generic.IEnumerable{System.String}
- optionOverrides System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{System.String,System.String}}
- commandLine ComputerX.Services.WindowsServiceCommandLine@
public static Boolean TryReadCommandLineBackup(String backupPath, out WindowsServiceCommandLine commandLine) #BooleanTries to read a previously backed up service command line from a file on the current machine.
Parameters
- backupPath System.String
- commandLine ComputerX.Services.WindowsServiceCommandLine@
public static Boolean TryReadCommandLineBackup(String backupPath, String executablePathOverride, out WindowsServiceCommandLine commandLine) #BooleanTries to read a previously backed up service command line from a file on the current machine and optionally rebases it to another executable path.
Parameters
- backupPath System.String
- executablePathOverride System.String
- commandLine ComputerX.Services.WindowsServiceCommandLine@
public static Boolean TryReadCommandLineBackup(String backupPath, String executablePathOverride, IEnumerable<String> requiredOptions, IEnumerable<KeyValuePair<String, String>> optionOverrides, out WindowsServiceCommandLine commandLine) #BooleanTries to read and prepare a command line from a backup file using required option checks and option overrides.
Parameters
- backupPath System.String
- executablePathOverride System.String
- requiredOptions System.Collections.Generic.IEnumerable{System.String}
- optionOverrides System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{System.String,System.String}}
- commandLine ComputerX.Services.WindowsServiceCommandLine@
public static WindowsServiceStatusSnapshot Uninstall(String serviceName, Nullable<TimeSpan> timeout = null) #WindowsServiceStatusSnapshotDeletes an installed Windows service.
Parameters
- serviceName System.String
- timeout System.Nullable{System.TimeSpan} = null
public static WindowsServiceStatusSnapshot Uninstall(String machineName, String serviceName, Nullable<TimeSpan> timeout = null) #WindowsServiceStatusSnapshotDeletes an installed Windows service from the specified computer.
Parameters
- machineName System.String
- serviceName System.String
- timeout System.Nullable{System.TimeSpan} = null
public static WindowsServiceStatusSnapshot Update(WindowsServiceInstallRequest request) #WindowsServiceStatusSnapshotUpdates an installed Windows service and optionally starts it.
Parameters
- request ComputerX.Services.WindowsServiceInstallRequest
public static WindowsServiceStatusSnapshot Update(String machineName, WindowsServiceInstallRequest request) #WindowsServiceStatusSnapshotUpdates an installed Windows service on the specified computer and optionally starts it.
Parameters
- machineName System.String
- request ComputerX.Services.WindowsServiceInstallRequest
public static Void UpdateCommandLine(String serviceName, WindowsServiceCommandLine commandLine, String displayName = null) #VoidUpdates only the SCM binary path for an installed local Windows service.
Parameters
- serviceName System.String
- commandLine ComputerX.Services.WindowsServiceCommandLine
- displayName System.String = null
public static Void UpdateCommandLine(String machineName, String serviceName, WindowsServiceCommandLine commandLine, String displayName = null) #VoidUpdates only the SCM binary path for an installed Windows service on the specified computer.
Parameters
- machineName System.String
- serviceName System.String
- commandLine ComputerX.Services.WindowsServiceCommandLine
- displayName System.String = null
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object