Lessons Learned

My drop-site for interesting snippets and tips. If it's useful to you as well, great!

Browse by Tags

Tagged Content List
  • Blog Post: YOMER Yet One More Error Reporting (Method)

    I wrote about creating an Out-Error function before to avoid outputting the stack dump that a normal Write-Error displays.  Many newcomers to PSH take one look at the huge blob of angry red text and throw up their hands in frustration. Write-Error is useful in populating $Error, which is very useful...
  • Blog Post: Write-Error, $Error, and Users

    Write-Error is useful, but the output is intimidating for new users.  You want them to see a nice message, but they get a wall of red text including a stack dump. Here’s a way to output it as a warning, but populate $Error as well. function Out-Error { param ( [String]$Message = "No error...
  • Blog Post: Capturing Write-Noun Cmdlet Output

    I’m sure there’s a cleaner way to capture the output from Write-Host, Write-Verbose, etc.  However, I’m just going to “go caveman” in the words of a coworker and just hack around with the Verb-Transcript cmdlets. Without further ado: function Get-MisbehavingCmdletOutput { param ( [System.Management...
Page 1 of 1 (3 items)