I'm wondering if it's possible to get a System.Management.Automation.PowerShell object from within a PowerShell console host, or Integrated Scripting Editor (ISE). I know that you can access the Runspace object by calling $Host.Runspace, but I need direct access to a PowerShell object (if it exists).
Would the only option be to create a new PowerShell object, and then call the code inside of that, or is there a way to access a pre-created PowerShell object using the $Host variable (or similar)?
PowerShellinstance?PSDataStreamsproperty on it.