Skip to content

Conversation

@lahell
Copy link
Contributor

@lahell lahell commented Oct 19, 2020

Fixes #123

Attempting to use Out-ConsoleGridView in remote sessions will result in an unexpected error and crashing out of the remote session. This PR will make sure OCGV instead throws a terminating PSNotSupportedException without exiting the remote session.

Behaviour before PR:

PS C:\Users\admin> $session = New-PSSession -HostName computer -UserName admin
admin@computer's password:
PS C:\Users\admin> Enter-PSSession -Session $session
[admin@computer]: PS /home/admin> Get-Process | Out-ConsoleGridView
There is an error processing data from the background process. Error reported: 'exadecimal value 0x1B, is an invalid character. Line 1, position 1..
PS C:\Users\admin>

Behaviour after PR:

PS C:\Users\admin> $session = New-PSSession -HostName computer -UserName admin
admin@computer's password:
PS C:\Users\admin> Enter-PSSession -Session $session
[admin@computer]: PS /home/admin> Get-Process | Out-ConsoleGridView

Error: Not supported in this environment (when input is redirected).
[admin@computer]: PS /home/admin>

Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TylerLeonhardt TylerLeonhardt merged commit b3abee1 into PowerShell:master Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OCGV: Does not seem to work in remote PSSession

2 participants