January 6th, 2016

A Favorite PowerShell ISE Feature: Module Browser

Doctor Scripto
Scripter

Summary: Sean Kearney shows you how to access modules in the PowerShell Gallery.

Honorary Scripting Guy, Sean Kearney, is here today to introduce you to a feature you may not have heard of called the Module Browser for the PowerShell ISE.

   Note   This is a five-part series that includes the following posts about features in the Windows PowerShell ISE:

One of the newest things coming out of Microsoft is a central website called the PowerShell Gallery. This is a central repository of scripts that the community can use programmatically.

A perfect example of this in action is Desired State Configuration (DSC). The needed code for a particular resource may not be on a server. However, you can now pull these DSC resources directly from the PowerShell Gallery.

This allows administrators to simply define the resources they need, such as a DHCP resource, to be brought down as they need it. It also means if there have been improvements or bug fixes, these resources have the potential to receive them in a more automated fashion.

Administrators and power users who need modules for their day-to-day activities can use the Find-Module and Find-Package capabilities in Windows PowerShell 5.0 to consume these resources.

If you install the Module Browser for the PowerShell ISE, it will give you the ability to access and work with these modules directly in the PowerShell ISE. You can download this free add-on from the PowerShell Gallery: ISEModuleBrowserAddon 1.0.1.

Image of menu

After you download and install it, you’ll have a new module that you can import. With the PowerShell ISE in the Console view, run the following line:

Image of command

When it is complete, you will see that the Module Browser was added to the Add-on Tool menu. Initially, you may see a small message that says Initializing, with an Accept button. Click the Accept button to continue.

Image of menu

At this point, you are connected to the PowerShell Gallery. If you press ENTER in the search panel, it will do a generic wildcard search of the Gallery. The results will be in alphabetical order. In the following example, I used an asterisk ( * ) as a wildcard character, which produces the same result.

Image of menu

If you were to enter a word, such as Azure or DSC, it would search for all modules with those characters in the name.

When you click any module, you can choose Add to Favorites or Open to download and view it.

Image of menu

If you click Add to favorites, it will add this module to a built-in list of favorites for the Module Browser. This is not related to your Internet favorites list. If you click the Favorites tab, you will see the current list of favorites on your system:

Image of menu

If you’d like to obtain a module, click the name of the module, and then click Open.

Image of menu

Clicking Open provides details about the module, including the hyperlink to the module in the PowerShell Gallery, the name of the author, and a general description of its purpose.

Image of menu

Click Install to download and install the module for all users on the computer. It is stored in the common location for PowerShell modules (typically C:\Program Files\WindowsPowerShell\Modules).

After it is downloaded, you can access the module normally by using Import-Module. However, if you’d like to open this module for editing, you can click the Open button, which appears after the module is downloaded.

Image of menu

This provides a list of files that the module contains and allows you to directly open the folder. At this point, you can access, download, and consume or edit these modules within the PowerShell ISE.

Pop by for a visit tomorrow when I’ll take a look at another cool feature that IT pros will enjoy using in the PowerShell ISE: Snippets.

I invite you to follow the Scripting Guys on Twitter and Facebook. If you have any questions, send email to them at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, always remember that with great PowerShell comes great responsibility.

Sean Kearney, Honorary Scripting Guy, Cloud and Datacenter Management MVP

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.