Scripting Games FAQ: Appropriate Use of Comments

Most judges love to see comments in scripts – provided they are useful and tell us something new.

# Get the WMI Object
$o = Get-WmiObject –Class Win32_BIOS

Don’t do that. The comment, there, is completely superfluous. Also, don’t do this:

# Using WMI instead of CIM because some
# computers might have Windows 7 and I won’t know
# if remoting is enabled or not so this is safer
$o = Get-WmiObject –Class Win32_BIOS

We call that “putting lengthy justification into the script.” In other words, you think something in the scenario is trying to trick you, and you’re pointing out that you “caught” the trick, and you were clever, or something. Nope. Nobody was trying to trick you, and reading lengthy comment-based rationales just make judges want to skip your entry and move on to something less wordy. Again, we’re looking for your team to exercise creativity and to have a little fun. This is not a certification exam.

Posted in:
About the Author

PowerShell.org Announcer

This is the official account for PowerShell.org and sponsor announcements.