Previous Topic: push-client Command--Install the Autoshell Client on a Remote Windows System (Funclet)Next Topic: PW_GET Command--Input Hidden Data (Funclet)


push-winRemote Command--Copy and Execute on Multiple Remote Windows Systems (Funclet)

This command copies and executes on one or multiple remote Windows systems. Available versions are:

The command has the following syntax:

(1) push-winRemote -host hostname -localPath path [-cmd cmd] [-user username] [-pass password]
(2) push-winRemote -localPath path [-cmd cmd] [-user username] [-pass password] on remoteTargets

The single target version returns the result code of the executed command.

The multi-target version returns an array of WinRemote objects. Each element of this array corresponds by position to the remote Windows node listed in the remoteTargets list. The WinRemote objects can verify verify whether errors occur and query the output and returned result if execution completes. If a remote node is specified using an WinRemote object, the array contains a reference to the original RemoteTarget object. If a target system is specified by a string, a new RemoteTarget object is created internally and assigned to the array.

-host hostname

Specifies the name of the remote Windows host. Unquoted argument tokens are automatically stringified. Prevent automatic quoting for expressions by placing expression code in parentheses.

-localPath path

Specifies the path pointing to the AutoShell client to copy. Unquoted argument tokens are automatically stringified. Prevent automatic quoting for expressions by placing expression code in parentheses. This parameter is only required when creating an SSH session on the fly using public key authentication.

Default: ""

-cmd cmd

(Optional) Specifies the command to execute on the remote Windows system. Unquoted argument tokens are automatically stringified. Prevent automatic quoting for expressions by placing expression code in parentheses. This parameter is only required when creating an SSH session on the fly using public key authentication.

Default: ""

-user username

(Optional) Specifies the user name to log in to the remote Windows system. The user must have rights to connect to the $ADMIN share. If no user name is specified, the user name entered during AutoShell login is used. Unquoted argument tokens are automatically stringified. Prevent automatic quoting for expressions by placing expression code in parentheses.

Default: $$User

-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. To enter a hidden password after issuing this command, specify PW_GET() with an optional prompt as argument. Unquoted argument tokens are automatically stringified. Prevent automatic quoting for expressions place the expression code into parentheses.

Default: $$Pass

on remoteTargets

Specifies a comma-separated list of remote systems to run the specified script on. The target nodes can be identified in two ways: By hostname/address or by WinRemote objects. Specifying target systems by name or address while using WinRemote objects offers more flexibility to control the execution process, for example, different credentials for different hosts. WinRemote objects and strings with hostname/address can be mixed in the remote target list. Elements of the target list are not automatically stringified, so when using literal strings for hostnames they must be placed into quotes.

Examples

To install myinstall.exe on host1:

push-winRemote -host host1 -localpath c:\installations\myinstall.exe -cmd myinstall.exe

To install myinstall.exe on host1 and host 2 and verify the results on host1:

push-winRemote -cmd myinstall.exe -localpath c:\installations\myinstall.exe on "host1", "host2";
? x[0].hasCompleted();
? x[0].result();
? x[0].output();

See also:

push-client Command--Install the Autoshell Client on a Remote Windows System (Funclet)

rem-client Command--Remove the Autoshell Client from a Remote Windows System (Funclet)

run-client Command--Run the Autoshell Client on a Remote Windows System (Funclet)

run-winRemote Command--Execute a Command on Multiple Remote Windows Systems (Funclet)