You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example shows how to start an interactive session using Secure Shell (SSH). If SSH is configured on the remote computer to prompt for passwords then you will get a password prompt. Otherwise you will have to use SSH key based user authentication.
162
162
163
163
### Example 7: Start an interactive session using SSH and specify the Port and user authentication key
This example shows how to start an interactive session using SSH. It uses the *Port* parameter to specify the port to use and the *KeyFilePath* parameter to specify an RSA key used to authenticate the user on the remote computer.
Specifies a computer name for a Secure Shell (SSH) based connection.
425
425
This is similar to the *ComputerName* parameter except that the connection to the remote computer is made using SSH rather than Windows WinRM.
426
+
This parameter supports specifying the user name and/or port as part of the host name parameter value using
427
+
the form `user@hostname:port`.
428
+
The user name and/or port specified as part of the host name takes precedent over the `-UserName` and `-Port` parameters, if specified.
429
+
This allows passing multiple computer names to this parameter where some have specific user names and/or ports, while others use the user name and/or port from the `-UserName` and `-Port` parameters.
This example shows how to run a command on a remote computer using Secure Shell (SSH). If SSH is configured on the remote computer to prompt for passwords then you will get a password prompt. Otherwise you will have to use SSH key based user authentication.
498
498
499
499
### Example 18: Run a command on a remote computer using SSH and specify a user authentication key
This example shows how to run a command on a remote computer using SSH and specifying a key file for user authentication. You will not get a password prompt unless the key authentication fails and the remote computer is configured to allow basic password authentication.
505
505
506
506
### Example 19: Run a script file on multiple remote computers using SSH as a job
Specifies an array of computer names for a Secure Shell (SSH) based connection. This is similar to the ComputerName parameter except that the connection to the remote computer is made using SSH rather than Windows WinRM.
1174
+
This parameter supports specifying the user name and/or port as part of the host name parameter value using
1175
+
the form `user@hostname:port`.
1176
+
The user name and/or port specified as part of the host name takes precedent over the `-UserName` and `-Port` parameters, if specified.
1177
+
This allows passing multiple computer names to this parameter where some have specific user names and/or ports, while others use the user name and/or port from the `-UserName` and `-Port` parameters.
This parameter takes an array of hashtables where each hashtable contains one or more connection parameters needed to establish a Secure Shell (SSH) connection (HostName, Port, UserName, KeyFilePath, Subsystem).
1252
1256
1253
1257
The hashtable connection parameters are the same as defined for the HostName parameter set.
1258
+
Note that the order of the keys in the hashtable result in user name and port being used for the connection where the last one specified is used. For example, if you use `@{UserName="first";HostName="second@host"}`, then the user name `second` will be used. However, if you use `@{HostName="second@host:22";Port=23}`, then port 23 will be used.
1254
1259
1255
1260
The SSHConnection parameter is useful for creating multiple sessions where each session requires different connection information.
This example shows how to create a new **PSSession** using Secure Shell (SSH). If SSH is configured on the remote computer to prompt for passwords then you will get a password prompt. Otherwise you will have to use SSH key based user authentication.
220
220
221
221
### Example 13: Create a session using SSH and specify the port and user authentication key
This example shows how to create a **PSSession** using Secure Shell (SSH). It uses the *Port* parameter to specify the port to use and the *KeyFilePath* parameter to specify an RSA key used to identify and authenticate the user on the remote computer.
226
226
227
227
### Example 14: Create multiple sessions using SSH
This example shows how to create multiple sessions using Secure Shell (SSH) and the **SSHConnection** parameter set. The *SSHConnection* parameter takes an array of hash tables that contain connection information for each session. Note that this example requires that the target remote computers have SSH configured to support key based user authentication.
Specifies an array of computer names for a Secure Shell (SSH) based connection. This is similar to the ComputerName parameter except that the connection to the remote computer is made using SSH rather than Windows WinRM.
700
+
This parameter supports specifying the user name and/or port as part of the host name parameter value using
701
+
the form `user@hostname:port`.
702
+
The user name and/or port specified as part of the host name takes precedent over the `-UserName` and `-Port` parameters, if specified.
703
+
This allows passing multiple computer names to this parameter where some have specific user names and/or ports, while others use the user name and/or port from the `-UserName` and `-Port` parameters.
This parameter takes an array of hashtables where each hashtable contains one or more connection parameters needed to establish a Secure Shell (SSH) connection (HostName, Port, UserName, KeyFilePath, Subsystem).
778
782
779
783
The hashtable connection parameters are the same as defined for the **HostName** parameter set.
784
+
Note that the order of the keys in the hashtable result in user name and port being used for the connection where the last one specified is used. For example, if you use `@{UserName="first";HostName="second@host"}`, then the user name `second` will be used. However, if you use `@{HostName="second@host:22";Port=23}`, then port 23 will be used.
785
+
786
+
This parameter was introduced in PowerShell 6.0.
780
787
781
788
The *SSHConnection* parameter is useful for creating multiple sessions where each session requires different connection information.
0 commit comments