PowerShell Tip #1 from the Winner of the Advanced Category in the 2013 Scripting Games

In case you haven’t heard, the 2014 Winter Scripting Games are just now getting started. Regardless of your skill level with PowerShell, it couldn’t be a better time to participate since this is the first time in the history of the scripting games that you’ll be able to work as part of a team and receive proactive feedback (before your code is judged) from a team of expert coaches who use PowerShell in the real world on a daily basis. Ultimately, the scripting games make learning PowerShell more interesting and challenging while giving you the opportunity to network with other enthusiasts in the industry.

Now it’s time to talk about a PowerShell tip that I wanted to share.

Tip #1 – Read the Help!

While this may not be the most popular tip, believe it or not, it’s one of the most important and it’s something that’s so simple it’s often times overlooked. In my opinion, you’ll never truly be effective with PowerShell and be able to figure things out for yourself until you learn to read the help.

I have an entire recorded presentation dedicated to the three core cmdlets that is titled “PowerShell Fundamentals for Beginners” if you would like more information about them:

Don’t assume that you know what a parameter does based on its name. The Invoke-Command cmdlet has a SessionName parameter that was added in PowerShell version 3.

I’ll create a PSSession to a computer named DC01 and I’ll name the session “dcSession”:

sg-tip1a

Without reading the help, it’s plausible to think that you could use the PowerShell remoting Invoke-Command cmdlet along with its SessionName parameter specifying the name of the session that you just created as its value:

sg-tip1b

Unfortunately, that wouldn’t be correct. Why? Because you didn’t read the help to find out what that particular parameter actually did before attempting to use it. If you had read the help first, you would have discovered that the SessionName parameter is only valid with the InDisconnectedSession parameter:

sg-tip1c

I’ll now remove the PSSession that I previously created since it’s no longer needed:

sg-tip1d

You can also teach yourself about cmdlets that you didn’t know existed or more about the ones you did by reading the help. One of the tips I wrote about in a guest article that I wrote for PowerShell Magazine was how to “learn a PowerShell cmdlet a day”:

sg-tip1e

In addition to cmdlet help, PowerShell also has “about” help topics which contain information about various aspects of PowerShell such as concepts, keywords, scripting constructs, conditional logic, etc:

sg-tip1f

One of my personal favorite products for reading PowerShell help offline is iPowerShell Pro which is an app for iPad and iPhone by SAPIEN Technologies.

Be sure to read the other articles about the scripting games on PowerShell.org as they contain tips that will make your scripting games experience more enjoyable and then head on over to ScriptingGames.org to sign up so you can participate!

Read the next article (tip #2) in this series of blog articles.

µ

About Mike F Robbins

PowerShell Enthusiast | IT Pro | Winner of the Advanced Category in the 2013 PowerShell Scripting Games | Author of Chapter 6 in the PowerShell Deep Dives Book.
This entry was posted in PowerShell, Scripting Games and tagged , . Bookmark the permalink.

One Response to PowerShell Tip #1 from the Winner of the Advanced Category in the 2013 Scripting Games

  1. Pingback: PowerShell Tip #1 from the Winner of the Advanced Category in the 2013 Scripting Games | PowerShell.org

Leave a Reply