PowerShell Connect-PSSession Cmdlet

PowerShell Connect-PSSession Cmdlet

PowerShell Connect-PSSession Cmdlet

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed Disconnect-PSSession cmdlet in PowerShell.

https://cloudaffaire.com/powershell-disconnect-pssession-cmdlet/

In this blog post, we will discuss Connect-PSSession cmdlet in PowerShell. You can use Connect-PSSession cmdlet to connect to a disconnected PSSession. Using Connect-PSSession cmdlet, you can only connect to the session that were started by you and is in a disconnected state. Connect-PSSession cmdlet cannot be used to connect to PSSession created by others (unless you have the credentials) or if the session state is broken or closed.

Connect-PSSession Cmdlet Syntax:

Connect-PSSession Cmdlet Argument List:

  • AllowRedirection: Indicates that this cmdlet allows redirection of this connection to an alternate URI.
  • ApplicationName: Specifies the name of an application. This cmdlet connects only to sessions that use the specified application.
  • Authentication: Specifies the mechanism that is used to authenticate user credentials in the command to reconnect to the disconnected session. The acceptable values for this parameter are:
    • Default
    • Basic
    • Credssp
    • Digest
    • Kerberos
    • Negotiate
    • NegotiateWithImplicitCredential
  • CertificateThumbprint: Specifies the digital public key certificate (X509) of a user account that has permission to connect to the disconnected session. Enter the certificate thumbprint of the certificate.
  • ComputerName: Specifies the computers on which the disconnected sessions are stored. Sessions are stored on the computer that is at the server-side or receiving end of a connection. The default is the local computer.
  • ConfigurationName: Connects only to sessions that use the specified session configuration.
  • Confirm: Prompts you for confirmation before running the cmdlet.
  • ConnectionUri: Specifies the URIs of the connection endpoints for the disconnected sessions.
  • Credential: Specifies a user account that has permission to connect to the disconnected session. The default is the current user.
  • Id: Specifies the IDs of the disconnected sessions. The Id parameter works only when the disconnected session was previously connected to the current session.
  • InstanceId: Specifies the instance IDs of the disconnected sessions.
  • Name: Specifies the friendly names of the disconnected sessions.
  • Port: Specifies the network port on the remote computer that is used to reconnect to the session.
  • Session: Specifies the disconnected sessions. Enter a variable that contains the PSSession objects or a command that creates or gets the PSSession objects, such as a Get-PSSession command.
  • SessionOption: Specifies advanced options for the session. Enter a SessionOption object, such as one that you create by using the New-PSSessionOption cmdlet, or a hash table in which the keys are session option names and the values are session option values.
  • ThrottleLimit: Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used.
  • UseSSL: Indicates that this cmdlet uses the Secure Sockets Layer (SSL) protocol to connect to the disconnected session. By default, SSL is not used.
  • WhatIf: Shows what would happen if the cmdlet runs. The cmdlet is not run.

PowerShell Connect-PSSession Cmdlet:

Hope you have enjoyed this article. In the next blog post, we will discuss Remove-PSSession CmdLet in PowerShell.

To get more details on PowerShell, kindly follow below official documentation

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about?view=powershell-5.1

 

Leave a Reply

Close Menu