Tag: Scripting Games

My Solution to Iron Scripter 2019 Preparatory Challenge 1

Anyone who has competed in the scripting games before knows that I'm always looking for a challenge when it comes to writing PowerShell code. While the scripting games haven't been held in the last several years, they've somewhat been replaced by the Iron Scripter competition at the PowerShell + DevOps Global Summit and 2019 is shaping up to be no different. Think you've got skills? Bring them on! and Get-Involved. Whether you've previously competed or not, you should definitely head over to IronScripter.us Read more [...]

The PowerShell Iron Scripter: My solution to prequel puzzle 3

I've been working through the Iron Scripter 2018 prequel puzzles which can be found on PowerShell.org's website. In puzzle 3, you're asked to create a "reusable PowerShell artifact". To me, that almost always means a PowerShell function. One requirement is to pull information from the PowerShell.org RSS feed. Invoke-RestMethod which was introduced in PowerShell version 3.0 is the easiest way to accomplish that task. You're also asked to display the returned information in a way that allows the Read more [...]

Announcing the Winner of the PowerShell TFM Book Contest

Two weeks ago, I started a PowerShell contest which required the participants to convert a string of text to title case. I didn't specifically say title case but I explained that the first letter of each word should be converted to upper case and all remaining letters in each word should be converted to lower case. This was because a search on how to convert to title case with PowerShell gave away a good portion of the answer. There were a total of 22 entries in the contest and all of them were Read more [...]

Windows PowerShell TFM Book Contest and Giveaway

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 Read more [...]

My Solution: August 2015 PowerShell Scripting Games Puzzle

A couple of months ago, PowerShell.org announced that the PowerShell Scripting Games had been re-imagined as a monthly puzzle. In August, the second puzzle was published. The instructions stated that a one-liner could be used if you were using a newer version of PowerShell. A public JSON endpoint can be found at http://www.telize.com/geoip and your goal is to write some PowerShell code to display output similar to the following: Try to accomplish this with a Read more [...]

My Solution: July 2015 PowerShell Scripting Games Puzzle

Last month, PowerShell.org announced that the PowerShell Scripting Games had been re-imagined as a monthly puzzle and the first puzzle was published. The instructions stated to use a PowerShell one-liner that produces the following output. No more than one semicolon should be used, do not use the ForEach-Object cmdlet or one of its aliases. The one-liner should be able to target more than one computer and feel free to go crazy with a really short one-liner with aliases and whatever else. Although Read more [...]

PowerShell Tip from the Head Coach of the 2014 Winter Scripting Games: Design for Performance and Efficiency!

There are several concepts that come to mind when discussing the topic of designing your PowerShell commands for performance and efficiency, but in my opinion one of the items at the top of the list is "Filtering Left" which is what I'll be covering in this blog article. First, let's start out by taking a look at an example of a simple one-liner command that's poorly written from a performance and efficiency standpoint: When the previous command is run, all of Read more [...]

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

In my previous blog article (PowerShell Tip #2), I left off with the subject of inline help and stated there was a better way. I'm fast-forwarding through lots of concepts and jumping right into "Advanced Functions and Scripts" with this tip because they are where you'll find the answer to a "better way" to add inline help. The inline comments we saw in the previous tip looked like this: When looking at the syntax for this function, you can see that it has no parameters: CmdletBinding Read more [...]

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

Tip #2 - Comment (Document) your code! This is another one of those tips that probably isn't very popular, but regardless of how good you are at writing PowerShell scripts and functions, they're useless if no one else can figure out how to use them. You might be thinking that you're the only one who uses the PowerShell code that you write, but I'm sure that you like to go on vacation just like the rest of us and none of us are going to live forever. In my tip #1 blog you learned that you Read more [...]

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 Read more [...]

Introducing the Coaches of the 2014 Winter Scripting Games

A few weeks ago, just before the announcement to start recruiting your team for the 2014 Winter Scripting Games, I was contacted by Don Jones and Richard Siddaway about an opportunity to become the Head Coach for the Winter Scripting Games. I was honored to have been contacted and I'm a firm believer of taking advantage of opportunities when they emerge, especially when they're PowerShell related, so I graciously accepted. One of my first responsibilities was to recruit a small team of coaches. Read more [...]

How to Create PowerShell Script Modules and Module Manifests

My entry for the Scripting Games advanced event 4 contained four separate functions: I want to create a module that contains these functions. There are several different types of modules, but what I'll be creating is a "Script Module". Modules sound like something really complicated, but script modules are actually simple. Currently, I have the functions saved as a ps1 file which I dot-source to load the functions into memory, but I want to share this tool with others so it makes more sense to Read more [...]

Using a Counter Variable in a PowerShell Workflow Foreach -Parallel Loop

As I'm sure most of my blog readers are aware, I competed in the advanced track of the Scripting Games this year and ended up doing quite well. Two first place finishes and three second places finishes with the official judges and four first place crowd score finishes. I also ended up being the overall winner of the advanced track. A few days ago someone on twitter asked me as the winner of the Scripting Games advanced track, what I would do with it? I plan to use it as a tool. I'll continue doing Read more [...]

2013 PowerShell Scripting Games Advanced Event 6 – The Grand Finale

For me, the Scripting Games have been a great learning experience this year. I've used many PowerShell features that I hadn't used before such as splatting, ADSI, Workflows, and producing html webpages with PowerShell. I plan to write detailed followup blog articles on each of these topics over the next few months. Event 6 was definitely challenging since I hadn't used workflows before but I also knew that's what was really needed to accomplish the given task properly (In my opinion). While you Read more [...]

2013 PowerShell Scripting Games Advanced Event 4 – Auditors Love Greenbar Paper

The requirements for the 2013 Scripting Games Advanced Event 4 can be found here. For this event I created multiple functions and I'm going to quote chapter 6, section 1 of the "Learn PowerShell Toolmaking in a Month of Lunches" book written by Don Jones and Jeffery Hicks, published by Manning: A function should do one and only one of these things: Retrieve data from someplace Process data Output data to some place Put data into some visual format meant for human consumption I started Read more [...]

2013 PowerShell Scripting Games Advanced Event 3 – Bringing Bad Habits from the GUI to PowerShell

I’m seeing a trend with a lot of PowerShell scripters. Many of us have a GUI, non-scripting background and we moved to PowerShell because we didn't want to be button monkeys clicking through the same options in the GUI day in and day out. I've always heard, if you’re going to do something more than once, do it (script it) in PowerShell. The trend I’m seeing is many are bringing their bad habit of wanting to repeat themselves over and over, day in and day out, to PowerShell. They write Read more [...]