Some Event 3 Notes

I didn't see anyone (although I'll admit I haven't checked every entry) using my EnhancedHTML module from Creating HTML Reports in PowerShell. I am ensaddened.

But man, Event 3 shows that you can really do well by learning a wee bit of HTML. Knowing an H2 and HR tag makes for much pretty results. Take it as career advice.

As a nitpick, don't use Convert as a function verb unless all the function is going to do is convert something. It shouldn't "Get" as well. That said, because this event wants a single function that both gets and converts... which is something I'd ordinarily avoid packing into one function... no big. It's interesting to see the function names folks picked out.

Folks, test your scripts. Seriously.

I kinda giggled when I saw this comment in an entry:

# I'd like to Splat this but I don't know how / ran out of time

Heh. In general, this is like a cooking show. If you know your food doesn't taste good, don't bring it to the judges. And if you do bring it to them, don't tell them all the cool toppings you were going to add. Just give them what you made.

Note to self: Don't write scenarios that require HTML. It messes up the Scripting Games Web site. Duh.

You know, overall, I'm seeing good stuff. I ran through some of the low-scoring entries and didn't see anything that didn't deserve a lowered score. If you constructed your own HTML instead of using ConvertTo-HTML, you pretty much got universally dinged, and I can understand and support that philosophy.

Oh, and ConvertTo-HTML doesn't output to stdout, whoever wrote that. It writes to the pipeline. Big difference.

Folks, when using Get-WmiObject, use the -Filter parameter. Don't get everything and pipe it to Where-Object. Get the filtering done early - this is a huge performance concept.

This was interesting:

            [ValidateScript({Test-Connection -ComputerName $_ -Quiet -Count 2})]

I'm entirely unsure how I feel about this. I like the idea. I keep telling people than a Ping doesn't really tell you anything when you're about to use WMI, though. If the computer responds, WMI might still fail; if the computer doesn't respond, WMI might still succeed. A ping is not useful diagnostic information for WMI connections. I understand the desire to try and eliminate the WMI timeout, but you're not doing so. What if I block ICMP traffic but not WMI traffic - a very common thing at a lot of my clients? Just bear that in mind.

We're done with Hungarian notation ($objDisk, $strComputer). Time to move on.

Commenters: Dudes, you need to read. For example, this:

When localhost, an IP address, or an alias is provided, the actual computer name is not displayed on the web page and the file name is also incorrect. Consider using one of the properties from the WMI class that has the computer name instead of what the user provided on input.

Was next to a 1-star vote. Totally inappropriate. 1 star, as the voting page clearly indicates, is when the script is totally non-functional. "Bad entry - does not function at all" is what it says under 1 star. This comment was on a working script. Maybe it didn't fulfill every requirement, but seriously, you'd fire a guy whose script simply put an IP address instead of a computer name? No. This was a 3-star script according to the guidelines.

Anyway... things are looking great. On to Event 4, which opens for voting real soon!

About the Author

Don Jones

Don Jones is a Windows PowerShell MVP, author of several Windows PowerShell books (and other IT books), Co-founder and President/CEO of, PowerShell columnist for Microsoft TechNet Magazine, PowerShell educator, and designer/author of several Windows PowerShell courses (including Microsoft’s). Power to the shell!


  1. I agree with you on the Hungarian notation. It was perhaps useful in VB Script, but it never felt right for Powershell. I like verbose, non-abbreviated, title-case variable names in Powershell like $Computer, $Counter, $Path, $EmailBody, etc.

    Is there any official guidance on the topic, or is it simply a matter of aesthetic taste?

  2. Well Don, despite your comment above, I came here specifically looking for your EnhancedHTML stuff. Now if you could just point me in the right direction for that... Great training videos by the way. I have been watching them on and off as I have time and thats where I saw you show off the HTML reporting stuff. I can sure use that right now.

    • I'm not sure replying to a 3-year-old post is the best way to find things ;). You're fortunate that your comment was held for moderation, so I saw it. You're looking for the "Creating HTML Reports" ebooks, which is on the eBooks menu item. And, should you need help with anything in it, I'd urge you to consider posting in the forums rather than commenting on old posts! Otherwise it's likely your need will go unnoticed.