Previous Topic: pwd Command--Print Name of Working Directory (Cmdlet)Next Topic: rem-client Command--Remove the Autoshell Client from a Remote Windows System (Funclet)


query-service Command--Query the Status of a Windows Service (Funclet)

The query-service command queries the status of a Windows service on the local system or a remote system. The query-service command returns the status of the service as a string. Possible return values include:

The command has the following syntax:

query-service -svcName sName [-host hostname] [-user username] [-pass password]
-svcName sName

Specifies the name of the service.

-host hostname

(Optional) The name of the remote Windows system.

Default: ""

-user username

(Optional) The user name used to log in to the remote Windows system. Unquoted argument tokens are stringified automatically. Prevent automatic quoting for expressions by placing expression code in parentheses.

Default: ""

-pass password

The password used to log in to the remote Windows system. Unquoted argument tokens are stringified automatically. Prevent automatic quoting for expressions by placing expression code in parentheses.

Default: ""

Examples

To query the local Apache service

? query-service -svcName Apache2.2

To query the Microsoft SQL Server service on a remote server REMOTESYS

? query-service -svcName MSSQLSERVER -host REMOTESYS -user admin -pass notsecret

See also:

start-service Command--Start a Windows Service on a Remote or Local System (Funclet)

stop-service Command--Stop a Windows Service on a Remote or Local System (Funclet)