question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OCGV: Does not seem to work in remote PSSession

See original GitHub issue

Piping to Out-ConsoleGridView after Enter-PSSession produces an error and exits the PSSession. I have tried from Windows to MacOS and Windows to Ubuntu (WSL) using PowerShell 7.0.3 and Microsoft.PowerShell.ConsoleGuiTools 0.6.1.

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>

Is it caused by ESC in Dispose()?

If it’s not supposed to work in PSSession then perhaps check for the existence of $PSSenderInfo and handle it more gracefully without crashing out of the session.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
lahellcommented, Oct 19, 2020

Sorry about the confusion. My last commit will not make OCGV work over a remote session. It will fail with a terminating exception, but the remote session will not be closed. Only the last commit in the PR is needed.

1reaction
SteveL-MSFTcommented, Oct 15, 2020

I think for now, the cmdlet should check if it’s remote and fail gracefully. PowerShell remoting was designed to transport objects, so the text output for console rendering is confusing it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enter-PSSession : Connecting to Remote Server Failed
The error message means that your user account does not have access to create a remote PowerShell session from system A to system...
Read more >
Enter-PSSession unable to remote into a remote desktop
Enter-PSSession unable to remote into a remote desktop · You must be using an account that is an admin on the remote host...
Read more >
Mount DFS SMB share in remote PS session fails
5.142) and trying to mount a DFS share there (\10.44.5.143\dfs1\share1). It doesn't work correctly - I get error "A specified logon session does ......
Read more >
Remotely use CMDlet that's not on the remote pc
1 Answer 1 ... You need to import the module using Import-Module using a PSSession on the remote computer. You can manage remote...
Read more >
Mocking New-PSSession and Invoke-Command
So I'm testing a cmdlet that makes remote calls, but I don't want to actually make the remote calls in the test, so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found