Enter PSSession - PowerShell


Enter-PSSession establishes a remote PowerShell session with a target computer or session configuration, allowing you to run commands and manage resources remotely. It’s ideal for managing multiple systems, automating tasks, and troubleshooting issues from a centralized location.


Enter-PSSession [-ComputerName] <String> -ConnectionUri <Uri> [-ConfigurationName] <String> [-SessionOption] <PSSessionOption> [-Credential] <PSCredential> [-Authentication] <String> [-ProxyCredential] <PSCredential> [-Proxy] <Uri> [-InvokeCommand] <ScriptBlock> [-ThrottleLimit] <Int32> [-ErrorAction] <ActionPreference> [-WarningAction] <ActionPreference> [-Verbose] [-Debug] [-ErrorVariable] <String> [-WarningVariable] <String> [-OutVariable] <String> [-OutBuffer] <Int32> [-PipelineVariable] <String>


-ComputerName: Specifies the target computer’s name or IP address.

-ConnectionUri: The URL of the remote PowerShell session configuration.

-ConfigurationName: The name of a registered PowerShell session configuration.

-SessionOption: Configures session options, such as IdleTimeout and MaximumConnectionCount.

-Credential: The credentials required to connect to the remote session.

-Authentication: The authentication method to use, such as Kerberos or Negotiate.

-InvokeCommand: Executes the specified command in the remote session.


Example 1: Establishing a Session with a Remote Computer

Enter-PSSession -ComputerName "server01"

Example 2: Running a Command in a Remote Session

Enter-PSSession -ComputerName "server01" -InvokeCommand { Get-Process }

Example 3: Using a PowerShell Session Configuration

Enter-PSSession -ConfigurationName "MyConfiguration"

Common Issues

  • Ensure network connectivity between the local and remote systems.
  • Verify that the remote session is configured to allow external connections.
  • Use the -Authentication parameter to specify the correct authentication method for your environment.


Combine with Invoke-Command: Execute commands remotely using the Invoke-Command cmdlet within an Enter-PSSession session.

Use with DSC: Manage Desired State Configuration (DSC) resources in remote systems by establishing a session with the DSCPullServer role.

  • New-PSSession: Creates a new PowerShell session configuration.
  • Get-PSSession: Retrieves information about existing PowerShell sessions.
  • Remove-PSSession: Terminates a remote PowerShell session.