- Verbose output is not actually output unless $VerbosePreferenceis set at least to "Continue."
- Use the PowerShell type to run your cmdlet, and readVerboseRecordinstances from theStreams.Verbosepropery
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