Today is the first day of Autumn also known as fall here in North America and it’s my favorite time of the year. If nothing else, you’ve got to love the cooler weather and the changing of tree leaf colors. Last fall, a new version of the Windows PowerShell TFM book that I co-authored along with Jason Helmick was published and strangely enough, its design is remarkably similar to the colors that are associated with Autumn. SAPIEN Technologies who is the publisher of the book is providing one free printed copy of the Windows PowerShell TFM book to the winner of a contest that I’m holding here on my blog site to celebrate the beginning of Autumn. This contest will run for two weeks beginning now, September 23rd until 11:59am GMT on October 7th.
Today you’re going through the second round of interviews for a new job where you will be writing PowerShell tools day in and day out for other personel in the Information Technology department at the company you’re interviewing at. As noted during your first interview, applicants who make it to the second round of interviews are required to write a simple PowerShell tool. The interviewer has escorted you to a room and logged you into a computer. A message on the screen of the computer states that you’ve been tasked with creating a reusable tool in PowerShell that capitalizes the first letter of each word in a string of text and converts the remaining letters in each word to lower case. This tool should be able to accept pipeline input.
You start out by running a command in PowerShell that gives you the following output to determine what operating system the computer you’re using is running:
You determine that the computer you’re logged into is running the default version of PowerShell that ships with that operating system. Next you attempt to connect to the Internet only to receive an error and then you determine that the computer is not connected to a network:
Luckily, it appears that someone had run Update-Help on the computer while it was connected to a network. Although these screenshots were taken in the PowerShell console, you do have access to the PowerShell ISE (Integrated Scripting Environment) on the computer.
The completed tool should produce the following output:
To submit your entry, create a secret Gist and post the URL for the Gist as a comment to this blog article. The comments to this blog article will be made public at the conclusion of the contest. Only one entry per participant is allowed and if more than one entry is received from the same participant, only the first entry will be considered. If the same entry is received from multiple participants and that entry is chosen as the winner, the entry submitted first will be selected. Submitting an entry that is a public Gist will automatically disqualify the entry and participant.
The most simple, clear, and concise entry that follows best practices for writing a reusable tool in PowerShell wins. The winner will be announced on this blog site on October 8th.
Update – October 8th, 2015
Be sure to read the follow-up blog article to this one: “Announcing the Winner of the PowerShell TFM Book Contest“.