Enter-PSSession
Use Enter-PSSession to start an interactive remoting session, redirecting your prompt to a remote computer.
Documentation: Microsoft Learn — PowerShell module reference
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Enter-PSSession [[-ComputerName] <string>] [-Credential <PSCredential>] [-Port <Int32>] [-UseSSL] [-ConfigurationName <String>] [-Session <PSSession>] [<CommonParameters>]- Stage 1Enter-PSSession
-ComputerName -Credential -Port -UseSSL -ConfigurationName -Session
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
Enter-PSSession -ComputerName SRV01
Show reference output
Sample output · fictional data, shaped like the real thing
[SRV01]: PS C:\Users\demo>
Enter-PSSession -ComputerName SRV01 (2)
Show reference output
Sample output · fictional data, shaped like the real thing
[SRV01]: PS C:\Users\demo>
Run Exit-PSSession
Show reference output
Sample output · fictional data, shaped like the real thing
PS C:\Ops>
Parameters
Parameter definitions:
-ComputerName-Credential-Port-UseSSL-ConfigurationName-Session
Practical use and troubleshooting
Practical scenario: Use Enter-PSSession when you need to start an interactive remoting session, redirecting your prompt to a remote computer. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: A connection failure is not fixed by merely running locally as administrator. Confirm remoting is enabled on the target, its endpoint authorises your account, and the chosen authentication method is appropriate. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: New-PSSession. New-PSSession creates a reusable remoting session for automation; Enter-PSSession opens an interactive session. Interactive entry does not replace a pipeline-friendly Invoke-Command workflow. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Put this command to work
Work in an interactive remote session
Enter lab-server with Enter-PSSession, then return its complete service inventory. Leave the remote context active.
The sandbox is visible now. Sign in with Google only when you run or check a task; commands and temporary files are discarded when you leave.
Run a command to inspect its result.
Inspect starting data
Supported syntax
Virtual files
Recap
Enter-PSSession Use Enter-PSSession to start an interactive remoting session, redirecting your prompt to a remote computer.
Next: Get-PSSession