#PSTip Capture console screen

Note: This tip requires PowerShell 2.0 or above.

PowerShell has many logging capabilities but sometimes what you want is to capture what’s already written to the console. Capturing this information can be a challenge as you need to script the console buffer content. You can see how in this post by the PowerShell team blog. In the ISE however this task becomes a lot easier; it is just a matter of reading the content of the output (console) pane.

In ISE v2:

PS> $psise.CurrentPowerShellTab.Output.Text

In ISE v3:

PS> $psise.CurrentPowerShellTab.ConsolePane.Text
Share on: