Package as Service
<#
This function is called when the service is started. Once this function returns,
your service will be set to a Running state.
#>
function OnStart() {
}
<#
This function is called when the service is stopped. Once this function returns,
your service will be set to a Stopped state and the process will terminate.
#>
function OnStop() {
}
# Specifies whether this service can be stopped once started
$CanStop = $trueOnStart Function
OnStop Function
CanStop Variable
Arguments
Installing a Service for Windows PowerShell
Uninstall a Service for Windows PowerShell
Install a Service for PowerShell 7
Uninstall a Service for PowerShell 7
Last updated