Service
An open Windows service handle.
Returned by ScManager.open_service and
ScManager.create_service.
Methods
close()
Closes the service handle.
Closing an already-closed handle does nothing. This releases the handle; it does not stop or delete the service.
config() -> ServiceConfig
Fetches the current service configuration.
Returns
An immutable snapshot.
control control -> Status
Sends a control request.
Parameters
| Name | Type | Description |
|---|---|---|
control |
ControlRequest |
Control request. |
Returns
The status after the control is applied.
Example
delete()
Marks the service for deletion.
Windows removes the service once no handle to it remains open and it is not running.
query_status() -> Status
Fetches the current service status.
sec_desc … -> security.windows.SecDesc
Gets selected parts of the service's Windows security descriptor.
Parameters
| Name | Type | Description |
|---|---|---|
:owner? |
Bool |
Load the owner SID. Defaults to true. |
:group? |
Bool |
Load the primary group SID. Defaults to
true. |
:dacl? |
Bool |
Load the discretionary ACL. Defaults to
true. |
:sacl? |
Bool |
Load the system ACL. Defaults to false. |
start *args
Starts the service.
Parameters
| Name | Type | Description |
|---|---|---|
*args |
Str |
Arguments passed to the service's main. |
update_config …
Updates the supplied configuration fields. Omitted fields are left unchanged.
Parameters
| Name | Type | Description |
|---|---|---|
:service_type? |
ServiceTypeSpec |
Service type flags. |
:start_type? |
StartType |
Start type. |
:error_control? |
ErrorControl |
Error control level. |
:binary_path? |
(Str | fs.Path) |
Service command line, taking the forms
create_service accepts. |
:load_order_group? |
Str |
Load-order group. |
:dependencies? |
Iterable[Str] |
Service or load-order-group names this service depends on. |
:service_start_name? |
Str |
Account the service runs as. |
:password? |
Str |
Password for service_start_name. |
:display_name? |
Str |
Display name. |
Example
update_sec_desc ...options …
Applies the components a Windows security descriptor's mask selects.
Parameters
| Name | Type | Description |
|---|---|---|
desc? |
security.windows.SecDescSpec |
Descriptor to apply. |
...options |
Components, as sec_desc takes them, instead
of or alongside desc. |
wait_for_status_change mask -> Status
Waits until one of the requested status changes occurs.
Parameters
| Name | Type | Description |
|---|---|---|
mask |
NotifyMaskSpec |
Changes to observe. |
Returns
The status observed after the change.