Today is going to be a lot of fun. A few years ago, back when we were still running PowerShell 2.0 everywhere, I created a module to run a Bingo game in a PowerShell session. I primarily wrote the module as a learning tool for beginners wanting to know more about how to construct a module. The module also includes examples of some techniques such as a custom format file, exporting (or not) members from a module and splatting.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
Enough time has passed since I first worked on this that I decided to revisit and update for PowerShell 3.0 and later. I've gone through and cleaned up things that I had to do in v2 that now are better handled in v3 like ordered hash tables. I've also fixed a few bugs I missed the first time and added at least one new feature.
When you load the module, you can start a new bingo game by running Invoke-Bingo. I wanted to stick to an official verb for the function. But to make life easier, the module also defines aliases, Play-Bingo and simply, Bingo. Stick to standard verbs with your functions but feel free to add aliases to make your commands more user-friendly.
When you start a new game, I have a function that creates a custom object for the Bingo card. The old version launched a separate PowerShell window to call the numbers, but I have incorporated that into the main output.
You keep entering numbers as they are 'called' until a winning card is detected. There are separate functions for calling numbers and testing cards.
In this version I also added a parameter that will create a Speech object so that your computer can speak the called numbers to you! If you want to play multiple cards, open up separate PowerShell windows and run Invoke-Bingo -Cardonly.
This is also handy if there are several of you wanting to play. Only one person needs to be the caller. I should get together with Boe Prox and figure out a way to run this over a remoting session!
If you want to try this out, and I hope you do, download this zip file and extract to your modules folder. As always, I hope you pick up something useful. Or if nothing else you can kill some time waiting for that server reboot to finish.
Enjoy!
[Update: A slightly revised version of this module is now on GitHub.]