<servicecontroller>

Allows a Windows service to be controlled.

Parameters

Attribute Type Description Required
action
The action that should be performed on the service.
True
service string
The name of the service that should be controlled.
True
machine string
The name of the computer on which the service resides. The default is the local computer.
False
timeout double
The time, in milliseconds, the task will wait for the service to reach the desired status. The default is 5000 milliseconds.
False
failonerror bool
Determines if task failure stops the build, or is just reported. The default is true.
False
if bool
If true then the task will be executed; otherwise, skipped. The default is true.
False
unless bool
Opposite of NAnt.Core.Task.IfDefined. If false then the task will be executed; otherwise, skipped. The default is false.
False
verbose bool
Determines whether the task should report detailed build log messages. The default is false.
False

Examples

Starts the World Wide Web Publishing Service on the local computer.

<servicecontroller action="Start" service="w3svc" />

Stops the Alerter service on computer 'MOTHER'.

<servicecontroller action="Stop" service="Alerter" machine="MOTHER" />

Requirements

Assembly
NAnt.MSNet.dll
Namespace
NAnt.MSNet.Tasks