You are currently viewing PowerShell Get-PSSession Cmdlet

PowerShell Get-PSSession Cmdlet

PowerShell Get-PSSession Cmdlet

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

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

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

In this blog post, we will discuss Get-PSSession cmdlet in PowerShell. You can use Get-PSSession cmdlet to get all the user-managed PSSession details on your local and remote computer. Using Get-PSSession cmdlet, you can get user-managed sessions PSSession objects” such as those that are created by using the New-PSSession, Enter-PSSession, and Invoke-Command cmdlets.

Get-PSSession Cmdlet Syntax:

Get-PSSession Cmdlet Argument List:

  • AllowRedirection: Indicates that this cmdlet allows redirection of this connection to an alternate Uniform Resource Identifier (URI).
  • ApplicationName: Specifies the application name segment of the connection URI. Use this parameter to specify the application name when you are not using the ConnectionURI parameter in the command.
  • Authentication: Specifies the mechanism that is used to authenticate the user’s credentials. 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 perform this action. Enter the certificate thumbprint of the certificate.
  • ComputerName: Specifies an array of names of computers. Gets the sessions that connect to the specified computers. Wildcard characters are not permitted. There is no default value.
  • ConfigurationName: Specifies the name of a configuration. This cmdlet gets only to sessions that use the specified session configuration.
  • ConnectionUri: Specifies a URI that defines the connection endpoint for the temporary session in which the Get-PSSession command runs. The URI must be fully qualified.. The format of this string is as follows: <Transport>://<ComputerName>:<Port>/<ApplicationName> The default value is as follows: http://localhost:5985/WSMAN
  • ContainerId: Specifies an array of IDs of containers. This cmdlet starts an interactive session with each of the specified containers.
  • Credential: Specifies a user account that has permission to do this action. The default is the current user.
  • EnableNetworkAccess: Indicates that this cmdlet adds an interactive security token to loopback sessions. The interactive token lets you run commands in the loopback session that get data from other computers.
  • Id: Specifies an array of session IDs. This cmdlet gets only the sessions with the specified IDs. Type one or more IDs, separated by commas, or use the range operator (..) to specify a range of IDs. You cannot use the ID parameter together with the ComputerName parameter.
  • InstanceId: Specifies an array of instance IDs of sessions. This cmdlet gets only the sessions with the specified instance IDs.
  • Name: Specifies an array of session names. This cmdlet gets only the sessions that have the specified friendly names. Wildcard characters are permitted.
  • Port: Specifies the specified network port that is used for the temporary connection in which the Get-PSSession command runs.
  • SessionOption: Specifies advanced options for the session. Enter a SessionOption object, such as one that you create by using the Get-PSSessionOption cmdlet, or a hash table in which the keys are session option names and the values are session option values.
  • State: Specifies a session state. This cmdlet gets only sessions in the specified state. The acceptable values for this parameter are: All, Opened, Disconnected, Closed, and Broken. The default value is All.
  • ThrottleLimit: Specifies the maximum number of concurrent connections that can be established to run the Get-PSSession command. If you omit this parameter or enter a value of 0 (zero), the default value, 32, is used. The throttle limit applies only to the current command, not to the session or to the computer.
  • UseSSL: Indicates that this cmdlet uses the Secure Sockets Layer (SSL) protocol to establish the connection in which the Get-PSSession command runs. By default, SSL is not used.
  • VMId: Specifies an array of ID of virtual machines. This cmdlet starts an interactive session with each of the specified virtual machines.
  • VMName: Specifies an array of names of virtual machines. This cmdlet starts an interactive session with each of the specified virtual machines.

PowerShell Get-PSSession Cmdlet:

Hope you have enjoyed this article. In the next blog post, we will discuss Enter-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