NAntContrib Help Function Reference service::get-status | v0.91-rc1 |
[This is preliminary documentation and subject to change.]
Gets the status of the specified service.
ServiceControllerStatus service::get-status(service, machineName)
Name | Type | Description |
---|---|---|
service | string | The short name that identifies the service to the system. |
machineName | string | The computer on which the service resides. |
For the machineName parameter, you can use "." or a zero-length String to represent the local computer.
The value returned by service::get-status() can be compared to either a corresponding enum field name or the underlying integral value.
Displays a warning if the Alerter service is stopping on SV-ARD-EAI1
.
<if test="${service::get-status('Alerter', 'SV-ARD-EAI1') == 'StopPending'}"> <echo level="Warning">The Alerter service is stopping.</echo> </if>
The "deploy-web-application" target is only executed if IIS is running on the local computer.
<target name="deploy" depends="deploy-sql-scripts, deploy-web-application" /> <target name="deploy-sql-scripts"> ... </target> <target name="deploy-web-application" if="$(service::get-status('World Wide Web Publishing', '.') == 4)}"> ... </target>