Getting Started with the PowerShell Gallery

Windows 10 has landed. It landed whilst I was in Seattle. 

Whilst in Seattle I was lucky enough to chat to some of the PowerShell Product Group. These are the guys that define the future of the product and then make it so. One of the new features they were keen to promote was the PowerShell Gallery:

"...The PowerShell Gallery is the central repository for Windows PowerShell content. In it, you can find useful Windows PowerShell modules containing Windows PowerShell commands and Desired State Configuration (DSC) resources. Some of these modules are authored by Microsoft, and others are authored by the Windows PowerShell community..."

 

Today's post will show a few things you'll need to get started with PSGallery. The gallery already contains a lot of very useful modules and I'll soon upload a couple of my own.

 

Find-Module

If you run Find-Module it is already configured to list the contents of the PSGallery repository. It is not automatically configured to make use of  NuGet-anycpu.exe, which interacts with NuGet galleries, such as PSGallery. This first time you run Find-Module you'll see the following:

 

Confirm the download and you'll be good to go:

 

Install-Module

Now to install a module from the gallery. It's as easy as running Install-Module with the module name (Run as Administrator):

 

Notice that we're downloading from an untrusted repository. Here's how to use Set-PSRepository to make the PSGallery trusted:

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

 

Let's see what the PSScriptAnalyzer module contains:

 

It's as easy as that. Get yourself on Windows 10 and, more importantly, PowerShell v5!