A PowerShell Warm-Up Exercise

baby weight liftinbg

It is time to get back to work exercising your PowerShell scripting muscles. The Iron Scripter event at the PowerShell & DevOps Global Summit will be returning this year, and The Chairman wants you in top shape.

It has been a while since the last scripting exercise, so The Chairman has prepared a warm-up challenge. There is something in today’s challenge for PowerShell scripters of all experience levels.

Beginner

Write PowerShell code to take a string like ‘PowerShell’ and display it in reverse. Your solution can be a simple script or function.

Intermediate

Your challenge is based on the Beginner exercise. Take a sentence like, “This is how you can improve your PowerShell skills,” and write PowerShell code to display the entire sentence in reverse with each word reversed. You should be able to encode and decode text. Ideally, your functions should take pipeline input.

Advanced

Once you’ve accomplished the intermediate-level task, create a PowerShell script to display a WPF form. The form should have a place where the user can enter a plaintext or encoded string and then buttons to encode or decode. The encoded or decoded value should be displayed in the form and copied to the clipboard. For bonus points, toggle upper and lower case when reversing the word. For example, ‘Shell’ should become ‘LLEHs.’

Sharing Results

As a reminder, and for those new to these challenges, you are encouraged to share links to your work and solutions in the comments. Comments with solutions will not be published. There is no single “right” way to accomplish these tasks. Part of the educational value comes from seeing how others tackled the problem. Even if you think your solution doesn’t offer you anything, it might help someone else.

Good luck and have fun.


5 Replies to “A PowerShell Warm-Up Exercise”

Leave a Reply

Your email address will not be published.