Scripting Games 2012: Quick Tips

Some things have really been standing out for me during the Scripting Games that I can’t contain anymore. So with that, here are a small list of things that you really really need to watch out for:

  • Know when to use Where-Object and when not to use Where-Object. Knowing this will help you avoid not only losing points on a script, but also can avoid impacting performance on your script. This also applies very well to Real-World scenarios.
  • Know how to deal with boolean values.
  • Know when to format your output and when not to format your output.
  • If the event says to do something, then do it. Failure to do so can and will cost you points.
  • Use of Get-Help and Get-Command will help you find that special cmdlet that will make your job a lot easier and then learn how to use it more efficiently.
  • Consider what you are planning on posting as your code and that you have ‘scrubbed’ it prior to submission.
  • If you are going to have “parameters” in your script/function, then read up on how to make them “parameters”. Think Param()…
  • Understand about line continuations. You can use |, { and ` to break the line and continue writing more code on the following line, but DO NOT combine these such as this:
Get-Process | `
Select Name,ID

This will work better:

Get-Process |	
Select, Name, ID

Ok, most of these are somewhat vague (and they are meant to be) and I will expand more on these after the games have completed. But consider these general guidelines to follow and think about when writing your code.

This entry was posted in News, Scripting Games 2012 and tagged , , . Bookmark the permalink.

1 Response to Scripting Games 2012: Quick Tips

  1. Pingback: Episode 182 – Joel Bennett on PowerShell v3 and PoshCode « PowerScripting Podcast

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s