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.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
You can easily check a module by comparing your local version against the repository.
Here you can see that I have installed the PoshWSUS module and it is still at version 2.2.1. But the online version is now 2.3.1.2. By the way, Find-Module will default to the Microsoft gallery so you don't have to specify the repository. I can use Update-Module to install the new version. But my goal is to be able to easily identify modules that can be updated. So I wrote a PowerShell function called Compare-Module.
The function gets all of your currently installed modules, gets a list of all modules in the gallery and then compares the version information. The function creates a custom object representing every installed module.
You can specify a module name with wildcards:
Or I can search all modules.
I could even use this function as a means of selectively updating:
Compare-Module | Out-Gridview -title "Select modules to update" -outputMode multiple | Foreach { Update-Module $_.name -force }
Or you might want to use Save-Module instead. The choice is yours.
I hope you'll give this spin and let me know what you think. As always, please post any problems or requests in the comments section on the Gist page.
Enjoy!
Brilliant, thanks! I wrote something like this for myself earlier this year but yours is far superior. Appreciated.
Jeffery:
Maybe your tips can be helpful. Somehow, somewhere I must have come across “The Lonely Administrator” and associated you with PowerShell. I have recently been exploring PS to find quality, pre-written PS scripts to incorporated into a managed services platform called ATERA.
You know the extent to which the evolution of remote monitoring and access have encroached into the today’s personal computing environment. This morning MVP story strikes at another time mark with respect to MSP functionality and PS incorporated functionalities.
Personally, I don’t see myself becoming a PS ‘guru’. I am already using about 36 or the 48 hours available in a day’s time and am hard pressed to add more expertise. For me, the answer would be a reliable, reputable resource for PS Scripts that can easily be plugged into my ATERA MSP platform to accomplish needed and desired tasks. Would you have any suggestions as to how to go about meeting such a challenge?
The direction Microsoft is taking is supporting NuGet-style repositories such as the PowerShell Gallery. I think the best direction would be to package your scripts and tools as PowerShell modules which you can publish to your own private repository. Clients would need to register and trust the new repository. Then they could use commands like Find-Module and Install-Module. Or you could give them wrapper scripts to query only your repository.
I have not setup my own repository so I can’t give you any guidance on that. There is a project on GitHub (https://github.com/PowerShell/PSPrivateGallery) on setting up private repositories in your own domain.
Good luck.