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.

Differences with Enter-PSSession

See original GitHub issue

When using pypsrp to start a session, there are some different to a session started with Enter-PSSession.

For example, using the Set-PSDebug or Trace-Command cmdlets seems to have no effect. And similarly, output from a script in a JEA role capabilities file configured using ScriptsToProcess does not come through to any of the session streams – such as the output from Write-Host "Hello world".

Is this a scoping issue or some other session configuration option that I have overlooked?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
malthecommented, Jan 17, 2022

I figured out how to make it work:

ps.add_cmdlet("Set-PSDebug").add_parameter("Trace", 1)
ps.add_cmdlet("Invoke-Job1")

That is, the equivalent of Set-PSDebug -Trace 1 | Invoke-Job1.

If I use ps.add_statement() before the second cmdlet, it stops working – I’m thinking that must be a scoping issue.

0reactions
jborean93commented, Jan 17, 2022

That’s interesting that you couldn’t have it span across statements as essentially the add_script example in mine was doing the same thing… It sounds like you’ve got a decent workaround and the problem was on the server side not respective the setting in the previous statement.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enter-PSSession vs New-PSSession : r/PowerShell - Reddit
Enter -PSSession: Starts a temporary interactive session with a remote computer. You can have only one interactive session at a time using Enter- ......
Read more >
Enter-PSSession - PowerShell - Microsoft Learn
This command starts an interactive session on the local computer. The command prompt changes to indicate that you are now running commands in...
Read more >
Enter-PSSession: Running Remote Commands in Interactive ...
The Enter-PSSession and New-PSSession cmdlets create a persistent one-to-one remote session and are used mostly in interactive scenarios. If you ...
Read more >
powershell - enter-pssession invoke-command, when to use?
New-PSSession - creates a persistent connection to a remote server and is generally used when you have a series of commands to run...
Read more >
Enter-PSSession - PowerShell - SS64.com
You can pipe a value for ComputerName. When the remote computer is in a different domain, use a fully qualified domain name. -ConfigurationName...
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