One of the attractive features in PowerShell v5 is PowerShellGet. This module includes commands which makes it easy to discover and install PowerShell modules from the Internet, or even your network. The modules are stored in online repositories. Microsoft maintains one called PSGallery. Typically you will use PowerShell commands to find and install modules. As a quick side note, while Microsoft appears to do some degree of review using the PowerShell Script Analyzer, there is no guarantee that modules you find online will work in your environment. That’s why the repository is untrusted by default. You can still download and install but you are accepting the potential risks. But that’s not the point here. It is pretty easy to download new modules, which includes DSC resources. However, new versions can be published to the online repository. As far as I know there is no notification mechanism. So you might have to periodically check to see if there are new versions available. Which means I wrote a tool.
So I’ve been sharing a number of PowerShell tools I’ve created for working with Git, including a few for getting tips from the Git Tips project on GitHub. My initial work was based on the fact that I had a local clone of that repository and wanted to search the local tips.json file. But I realized some of you may not want to clone the repository or be able to keep it up to date. Since the json file is available online and PowerShell has tools for grabbing Internet content, I decided to provide a version that combines the functionality of my earlier commands with the ease of searching online.
Recently I published a PowerShell function that I use to display a random Git Tip of the Day. The function relies on my clone of the Git-Tips project on GitHub. I’ve been keeping tabs on this project and a question was posed about creating a command line utility to search the tip list. Now, this project is most likely aimed at developers, at least based on what I’ve seen in the list of questions and issues. But for PowerShell people, this is a pretty simple thing to pull together.
As part of my process of learning an using Git I am trying to get in the habit of using meaningful commit messages. Sure, you can get by with a single line comment which is fine when running git log –oneline. But you can use a multi-line commit message. However, this requires a little planning which is probably not a bad thing. Because my Git projects are PowerShell related and I most often and in the PowerShell ISE I came up with a little trick that works for me.
I’m always on the lookout for new ways to do things. Often I’m trying to find a way to create something that is easy to use without requiring a lot of PowerShell scripting. I also like using the final result as teaching aids so even if you don’t need the end product, I hope you’ll pick up a trick or two that you can use in your own scripting projects. The task I had in mind today is a better way to get event log information. Not the events themselves, but rather the event log file. How many entries are in it? How big is it? How much of the configured log is being used? Here’s what I came up with.