Please feel free to provide feedback or file bugs here.

Some new default cmdlet parameters?

We have -ErrorVariable and -WarningVariable. To capture verbose output to a variable, you can $VerboseRecords = (Write-Verbose -Verbose "test") 4>&1 # and find it in $VerboseRecords.Message, but wouldn't it make sense to add a -VerboseVariable? Maybe even a -WriteHostVariable?

3 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Joakim Svendsen shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Joakim Svendsen commented  ·   ·  Flag as inappropriate

        You could say success or failure should be either Write-Error or Write-Warning, but I've found myself making this distinction in Write-Verbose output for some things.

        I'm having some weird design issues, likely caused by my weird brain... It's in my SSHSessions/SSH-Sessions module now, that I'm running across these "issues". Pipeline support, foreach to iterate the possible single pipeline variable element, to remedy allowed parameters (rather than pipeline input) with multiple entries as well, um... It's just getting messy. Feel like it's glued together with sort of bad glue. :(

      • Joakim Svendsen commented  ·   ·  Flag as inappropriate

        As additional context, I can mention that I came across this need when writing Pester tests for a module and needed to parse the verbose output stream to determine success or failure.

        Am I missing something here?

      Feedback and Knowledge Base