I am using Visual Studio Code 1.17.2 with the PowerShell extension (1.4.3). I have Write-Verbose
statements in my code. When I run the PowerShell script, the Verbose
output doesn't seem to go anywhere. How do I request that output be shown?
Go to File>Preferences>Setting and search for the Scrollback setting and increase the value to get the number of lines of output you want. This worked for me. Save this answer. Show activity on this post.
Start in Visual Studio Open Visual Studio. On the menu bar, select Tools > Command Line > Developer Command Prompt or Developer PowerShell.
Typically, the verbose message stream is used to deliver more in depth information about command processing. By default, the verbose message stream is not displayed, but you can display it by changing the value of the $VerbosePreference variable or using the Verbose common parameter in any command.
First look at the PowerShell Debugger in Visual Studio Code. Press Ctrl+Shift+P (Cmd+Shift+P on Mac) to open the PowerShell extension's Examples folder, type PowerShell open examples, and then press Enter. After the Examples folder has loaded, open the DebugTest.
The simplest approach is to execute
$VerbosePreference = 'Continue'
in the integrated PowerShell console before invoking your script (and executing $VerbosePreference = 'SilentlyContinue'
later to turn verbose output back off, if needed).
From that point on:
running a script (starting it with (F5) or without (Ctrl+F5) the debugger)
highlighting a section of code and running the selection (F8)
will make Write-Verbose
calls produce output.
If you want to preset $VerbosePreference = 'Continue'
every time the integrated console starts, put that statement in the $PROFILE
file:
If your VS Code-specific $PROFILE
file already exists, simply run psedit $PROFILE
from the integrated console.
If not, create the file first from the integrated console: New-Item -Type File $PROFILE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With