Previous Topic: set result display on/off Command--Turn Automatic Result Display On or Off (Cmdlet)Next Topic: stop-service Command--Stop a Windows Service on a Remote or Local System (Funclet)


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

The start-service command starts a Windows service on the local or remote system.

The command has the following syntax:

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

The command returns 1 on success and 0 on failure.

-svcName sName

Specifies the name of the service.

-host hostname

(Optional) The name of the remote server.

Default: ""

-user username

(Optional) Specifies the user name to use to log in to the remote node. Unquoted argument tokens are automatically stringified. Prevent automatic quoting for expressions by placing expression code in parentheses.

Default: ""

-pass password

(Optional) Specifies password to use to log in to the remote node. If no password is specified, the password entered during AutoShell login is used. Unquoted argument tokens are automatically stringified. Prevent automatic quoting for expressions by placing expression code in parentheses.

Default: ""

Examples

To start the local Apache service:

? start-service -svcName Apache2.2

To start the Microsoft SQL Server service on a remote server REMOTESRV

? start-service -svcName MSSQLSERVER -host REMOTESRV -user admin -pass notsecret