Check for Module Updates

It seems to me that the topic of finding or detecting module updates on the PowerShell Gallery has gotten a lot of interest over the last few days. So I thought I’d contribute my bit of code to check currently installed modules against their online versions in the PowerShell Gallery.

Continue reading

My Uptime PowerShell Module Published to GitHub

Earlier this year I wrote a PowerShell module to get uptime information. The module was part of a series I wrote for As part of my ongoing project to move some of my more interesting, and hopefully useful, tools to GitHub, I revised the module. The new version makes better use of custom format and type extensions, including the addition of several methods.

You can also now use a CIMSession instead of a computername and the results are “live”. Because I defined some script properties, uptime values are updated every time you view the object. I will be writing about the changes in more detail on But for now, you can find the module on GitHub. I hope you’ll let me know what you think and what would make it even better.

What’s the Weather?

clouds I have used a PowerShell module I wrote a while ago to retrieve weather information from Yahoo offers a set of web APIs which are free to use, that will provide weather information for a given location. The location is determined by a “Where On Earth ID”, or woeid. Fortunately, there are APIs to get that information as well. All of this is very easy to use with the Invoke-Webrequest cmdlet. The result is an XML document, which takes a little bit of work to parse out.

My module has a command to get a woeid:

Once you know that you can get weather information.

Or more detailed information:

You can even pipe one command to the other.

The cmdlets have complete help but instead of comment based help, I am using a MAML-based XML file. I created the file with an early version of SAPIEN’s PowerShell Help Writer.

Because I like to think the module contains some good examples of using Invoke-Webrequest and working with XML documents, I have published the module to Github. I hope you’ll give it a try and let me know what you think. At some point I might even publish it to the Microsoft PowerShell Gallery.

Friday Fun – Let’s Play a Game

BingoCard-smallToday 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.

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.


[Update: A slightly revised version of this module is now on GitHub.]

Friday Fun with Formatting

PowerShell is very adept at retrieving all sorts of information from computer systems in your network. Often the data is in a format that is hard to digest at a glance. For example, when you see a value like 1202716672 is that something in MB or GB? What if you need to view that value as KB? I don’t know about you but I’m not good at making those conversions in my head and on-the-fly. Instead, we often resort to commands like this.

That is much easier than seeing a value of 8589934592. The same thing applies when it comes to calculating percentages. Again, we’re back to using custom hashtables with Select-Object. Of course, you can go the extra mile and create custom format and type extensions. But sometimes, at least speaking for myself, you want something in between. So I created two functions, Format-Value and Format-Percent and packaged them as a module.

Format-Value will take any value and by default round it to an integer. Or you can specify to format the value as a certain unit of measurement such as GB or MB. You can even specify the number of decimal places. Or, you can use the -Autodetect parameter and the function will make the best guess about the ‘size’ of your value. Use -Verbose if you want to know what unit it detects.

I did a similar thing with percentages. All you have to do is specify a value and a total and the function does the rest. Again, you can specify the number of decimal places. By default, the function writes a numeric value to the pipeline which I find makes it easier if you want to sort. But you can also specify to get a percentage as a string which will use the -f operator. The string will include the % symbol. I take an extra step to remove the space between the value and symbol.

With the function, my PowerShell expressions become a little easier to write.

In the code sample I’m using the function and parameter aliases. But I like the result.

Download extract it to your modules directory and you should be good to go. I’ve set the minimum PowerShell version to 3.0 although there’s nothing I can think of that would prevent these commands from working on v2. But I’d like to drive you to at least 3 anyway.

I hope you’ll let me know what you think and what other types of data formatting you’d like to see added to the module.

NOTE: An update has been posted at