ServiceFunctions.

IsInstalled(string, string) Method

Summary

Returns a value indicating whether the specified service is installed on a given machine.
Assembly
NAnt.Contrib.dll
Namespace
NAnt.Contrib.Functions
Containing Type
ServiceFunctions

Syntax

[Function("is-installed")]
public static bool IsInstalled(string service, string machineName)

Examples

The following example starts the "World Wide Web Publishing" service if it's installed on the local computer.

    <if test="${service::is-installed('World Wide Web Publishing', '.')}">
    <servicecontroller action="Start" service="World Wide Web Publishing" />
</if>

Remarks

For the machineName parameter, you can use "." or a zero-length string to represent the local computer.

Attributes

Type Description
Function

Parameters

Name Type Description
service string The short name that identifies the service to the system.
machineName string The computer on which the service resides.

Return Value

Type Description
bool true if the service is installed; otherwise, false.