Lessons Learned

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

August, 2012

Posts
  • Lessons Learned

    Laziness and XML: New-XmlElement

    • 0 Comments
    I love structured data. I love how orderly it is, how logical. However, I do not like the repetition. Get the OwnerDoc. Create an Element. Loop over a bunch of AddAttribute calls, AppendChild it someplace. 90% of the time, this is how I build my XML structure...
  • Lessons Learned

    Getting OCS 2007 Certs through WMI

    • 0 Comments
    We recently had an interesting adventure where we needed to do an audit of the certificates used by various OCS servers. In this case, scanning the computer's cert store wasn't sufficient - we needed to see which cert was bound to what interface. The...
  • Lessons Learned

    Out-Error, the User-friendlier Write-Error

    • 0 Comments
    Write-Error is a pretty daunting cmdlet. It dumps some pretty useful information to screen. Useful, that is, for the scripter. For the non-PowerShell-guru end user, it can be pretty intimidating. Write-Host -ForegroundColor Red might be a better...
  • Lessons Learned

    Why Semi-Colons?

    • 0 Comments
    Sorry, no code here. Just a quick thought. Q: Why should I put semi-colons at the end of lines? PowerShell is smart enough to parse EOL as command terminators. A: Because some blogs are stupid and strip linefeeds. That means you get a single line...
  • Lessons Learned

    One-Liner: Dotting in vs. Running a Script

    • 0 Comments
    PowerShell scripts are a collection of functions and procedural code, right? So often, I find myself wishing I had a function defined in a script in my interactive session, but the script doesn't lend itself to being dotted into the environment. if...
Page 1 of 1 (5 items)