Reputation: 23355
When using Start-Transcript
verbose output is not captured in the transcript. For example:
Start-Transcript
Write-Verbose "This is a test of verbose output"
Stop-Transcript
Results in:
**********************
Windows PowerShell transcript start
Start time: 20170829110436
Username: xx\xx
RunAs User: xx\xx
Machine: SGC340 (Microsoft Windows NT 6.1.7601 Service Pack 1)
Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Process ID: 19596
PSVersion: 5.0.10586.117
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0.10586.117
BuildVersion: 10.0.10586.117
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
Transcript started, output file is C:\Users\xx\Documents\PowerShell_transcript.xx.EbGyj9PE.20170829110436.txt
PS C:\Users\xx> Write-Verbose "This is a test of verbose output"
PS C:\Users\xx> Stop-Transcript
**********************
Windows PowerShell transcript end
End time: 20170829110447
**********************
How do you capture Verbose output in a transcript?
Upvotes: 5
Views: 9064
Reputation: 23355
As discussed in this issue, verbose output does not appear because the default setting of $VerbosePreference
is 'SilentlyContinue'
. If you change it to 'Continue'
verbose output appears.
Equally if you had a script that made use of Start-Transcript
, you could add [cmdletbinding()]
to the top of your script and then execute it with the -Verbose
switch to have Verbose messages both visible and in the transcript.
Note that running Start-Transcript -Verbose
does not enable the logging of Verbose messages in the transcript (it just enables the Verbose output of the cmdlet itself).
Upvotes: 7