Invoke-PowerShellServer Cmdlet
Parameters Output Objects Configuration Settings
The Invoke-PowerShellServer Cmdlet is used to remotely execute a command on the PowerShell Server.
Syntax
Invoke-PowerShellServer [parameters]
Remarks
This cmdlet uses SSH to invoke a remote command on the PowerShell session hosted by the remote PowerShell Server. Using the cmdlet is very simple. The command is specified by the Command parameter. The command is executed on the remote shell, and the resulting objects are serialized and sent back to the client. PSObject instances with matching fields are reconstructed locally and then returned by the Invoke-PowerShellServerExpression cmdlet.
The cmdlets support pipeline input for some of their parameters. Prebuilding an object and piping it to the cmdlet is very useful, but should be used with caution to prevent security conflicts. Steps have been taken to decrease the risk of a possibly accidental pipe to the cmdlet, for instance, the Credential parameter cannot be piped to the cmdlet and must be specified manually.
# create an SSH connection and store the connection object in a shell variable
$conn = Connect-PowerShellServer -server SERVER -cred $mycred
#invoke a command on the remote connection
Invoke-PowerShellServer $conn -command ls
Connection Handling
This cmdlet supports persistent connections through the Connection parameter. To establish a new PowerShellServer connection, use the Connect-PowerShellServer cmdlet. To close the connection, use the Disconnect-PowerShellServer cmdlet.
Parameter List
The following is the full list of the parameters of the cmdlet with short descriptions. Click on the links for further details.
Connection | An already established connection. |
LogFile | The location of a file to which debug information is written. |
AuthMode | The type of authentication used by the cmdlet. |
CertPassword | The password to the certificate store. |
CertStore | The name of the certificate store for the client certificate. |
CertStoreType | The type of certificate store for the client certificate. |
CertSubject | The subject of the certificate used for client authentication. |
Command | The command to send to the remote SSH Server. |
CompressionAlgorithms | A comma-separated list containing all allowable compression algorithms. |
Config | Specifies one or more configuration settings. |
Credential | The PSCredential object to use for user/password authentication. |
EncryptionAlgorithms | A comma-separated list containing all allowable compression algorithms. |
FirewallHost | Name or IP address of firewall. |
FirewallPassword | A password if authentication is to be used when connecting through the firewall. |
FirewallPort | The port of the firewall to which to connect. |
FirewallType | Determines the type of firewall to connect through. |
FirewallUser | A user name if authentication is to be used connecting through a firewall. |
Force | Forces the cmdlet to accept the default behavior instead of querying the user. |
LocalIP | The IP address of the local interface to use. |
LogFile | The location of a file to which debug information is written. |
Password | The password to use for authentication. |
Port | The port to be used. |
Server | The address of the Server. |
SSHAccept | The hex-encoded fingerprint of the host to trust explicitly. |
Timeout | The maximum time allowed for the operation. |
User | The username to use for authentication. |
Output Objects
The following is the full list of the output objects returned by the cmdlet with short descriptions. Click on the links for further details.
SSHOutput | The PSObject object returned by the Invoke-PowerShellServerExpression Cmdlet will have properties matching those of the original object in the remote machine. |
Configuration Settings
The following is a list of configuration settings for the cmdlet with short descriptions. Click on the links for further details.
GSSAPIMechanisms | The desired GSS-API authentication mechanism. |
KerberosRealm | The fully qualified domain name of the Kerberos Realm to use for GSSAPI authentication. |
KerberosDelegation | If true, asks for credentials with delegation enabled during authentication. |
KerberosSPN | The Kerberos Service Principal Name of the SSH host. |
UseBackgroundThread | Whether threads created by the cmdlet are background threads. |
UseInternalSecurityAPI | Tells the cmdlet whether or not to use the system security libraries or an internal implementation. |