Playing with PowerShell Gallery Content

by Sep 27, 2017

The public PowerShell Gallery ( is a place where PowerShell scripters can freely exchange scripts and modules. All you need is PowerShell 5 with PowerShellGet which provides you with the cmdlets required to interact with the Gallery.

Of course, you are responsible for checking code and making sure it runs flawlessly and does not contain security issues.

One of the available modules is called “PSCredentialManager”. Here is how to find more information about this module:


PS> Find-Module -Name PSCredentialManager | Select-Object -Property *

Name                       : pscredentialmanager
Version                    : 1.0.1
Type                       : Module
Description                : This module allows management and automation of Windows cached credentials.
Author                     : Adam Bertram
CompanyName                : adamtheautomator
Copyright                  : (c) 2017 Adam Bertram. All rights reserved.
PublishedDate              : 18.06.2017 22:14:27

To install the module, run this:

PS> Install-Module -Name PSCredentialManager -Scope CurrentUser -RequiredVersion 0.6

Note that we explicitly ask to install version 0.6. At the time of writing, there was also a version 1.0.1 available which turned out to have some issues. When you retrieve content from a public place like the PowerShell Gallery, always expect the unexpected, and be careful.

If you want to examine the code before you install a module, you can also use Save-Module, and download the module to a quarantine place.

PS> Find-Module pscredentialmanager -AllVersions

Version    Name                    Repository           Description                      
-------    ----                    ----------           -----------                      
1.0.1      pscredentialmanager     PSGallery            This module allows 
0.6        pscredentialmanager     PSGallery            This module allows 
0.2        pscredentialmanager     PSGallery            This module allows 

Once installed, this command gives you a list of new cmdlets:

PS> Get-Command -Module pscredentialmanager

CommandType     Name                                               Version    Source                 
-----------     ----                                               -------    ------                 
Function        Get-CachedCredential                               0.6        pscredentialmanager    
Function        New-CachedCredential                               0.6        pscredentialmanager    
Function        Remove-CachedCredential                            0.6        pscredentialmanager    

You can now easily manage cached credentials. To dump a list of cached credentials, for example, try this:

PS> Get-CachedCredential

Name        : SSO_POP_User
Category    : MicrosoftAccount
Type        : Domain Extended Credentials 

And if you are curious to see how the new cmdlets (aka functions) work, you can take a look at the source code, too. This line copies the function source code to the clipboard:

PS> ${function:Get-CachedCredential} | clip

To get rid of the module again, uninstall it:

PS> Uninstall-Module -Name pscredentialmanager -AllVersions

Twitter This Tip! ReTweet this Tip!