- Verbose output is not actually output unless
$VerbosePreference
is set at least to "Continue." - Use the PowerShell type to run your
cmdlet
, and readVerboseRecord
instances from theStreams.Verbose
propery
Example in powershell script:
ps> $ps = [powershell]::create()
ps> $ps.Commands.AddScript("`$verbosepreference='continue'; write-verbose 42")
ps> $ps.invoke()
ps> $ps.streams.verbose
Message InvocationInfo PipelineIterationInfo
------- -------------- ---------------------
42 System.Management.Automation.Invocat... {0, 0}
This should be easy to translate into C#.
-Oisin
PowerShell MVP
x0n
2009-07-18 03:44:00