The stop-service command stops a Windows service on the local or remote system.
The command has the following syntax:
stop-service -svcName sName [-host hostname] [-user username] [-pass password]
The command returns 1 on success and 0 on failure.
Specifies the name of the service.
(Optional) The name of the remote server.
Default: ""
(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 parenthesis.
Default: ""
(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 parenthesis.
Default: ""
Examples
To stop the local Apache service:
? stop-service -svcName Apache2.2
To stop the Microsoft SQL Server service on a remote server REMOTESRV:
? stop-service -svcName MSSQLSERVER -host REMOTESRV -user admin -pass notsecret
Copyright © 2013 CA. All rights reserved. |
|