Adding New PowerShell Commands

by May 6, 2020

PowerShell is just a scripting platform and can be extended with new commands. A great source for new commands is the public PowerShell Gallery. You can visit the graphical front-end at and search for modules.

PowerShell comes with a module called PowerShellGet which in turn provides the commands to download and install extensions from the PowerShell Gallery. Let’s download and install a free command extension now.

One of the currently most popular general-purpose PowerShell command extensions is the free Carbon module with almost 4 million downloads in the past six weeks. To install it from the PowerShell Gallery, use Install-Module. When you use the CurrentUser scope, no administrator privileges are required:

PS> Install-Module -Name Carbon -Scope CurrentUser    

On first use, Install-Module asks for permission to download and use a “nuget” DLL which takes care of the downloading and installation process. Next, the requested module is downloaded and unpacked. Since the PowerShell Gallery is a public repository, you are asked for your consent to download material to your machine. Use the -Force parameter to skip this part.

Important: most PowerShell modules provided by the PowerShell Gallery are script-based. You need to allow scripts; else you cannot use script-based modules. If you haven’t allowed script execution yet, you can do so with this command:

PS> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force  

To view your new PowerShell commands, dump the list of commands contained in the newly added module:

PS> Get-Command -Module Carbon | Out-GridView   

Here is an example:

PS> Get-FileShare

Name   Path                              Description   
----   ----                              -----------   
ADMIN$ C:\Windows                        Remote Admin  
C$     C:\                               Default share 
print$ C:\Windows\system32\spool\drivers PrintDrivers 

Twitter This Tip! ReTweet this Tip!