How to install PowerShellGet Module in Windows 10 or 11?

PowerShell by Microsoft on their Windows operating system is a powerful scripting language. It can be used to automate various tasks using CLI for Windows desktop or server environments. Whereas, the PowerShellGet is a module in PowerShell that provides cmdlets for discovering, installing, updating, and publishing modules from various sources.

Here, in this article, we learn the steps to install PowerShellGet Module in PowerShell.

Prerequisites:

You Windows or Linux must have PowerShell to use the commands given in this article.

Step 1: Open & Check PowerShell Version

On Windows 10 or 11, right-click on the Start menu button and select “Windows PowerShell (Admin)”. Alternatively, users can click Search given near the start menu to search it.

Running Powershell as Admin for Windows 11

Now, check your Powershell version to confirm it is version 5.0 or above to use PowerShellGet.

$PSVersionTable.PSVersion
Check PowerShell Version

Step 2: Install PowerShellGet Module

Now, run the given command and it will automatically download the required files for the PowrShellGet Module installation for PowerShell in Windows and other operating systems you are using.

Install-Module -Name PowerShellGet -Force -AllowClobber

In the above command -Force parameter or option will replace if any old version of Get is already on your system whereas -AllowClobber allows overwriting existing conflicting commands.

Step 3: Verify the Installation

After executing the previous step command, we can confirm whether the PowerShellGet module is on our system or not, for that just execute the below-given command.

Get-Module -Name PowerShellGet -ListAvailable
Install PowerShell Get Module

(optional Further, if you are using the NuGet package provider module, then update it once to ensure compatibility with PowerShellGet.  

Update-Module -Name NuGet -Force

Step 4: PowerShellGet Usage

Here are the few basic cmdlets syntax to use with PowerShellGet for installing various Moudles and also to confirm it is working fine

To search for a module, use:

Find-Module -Name ModuleName

To install a module, use:

Install-Module -Name ModuleName

To update a module, use:

Update-Module -Name ModuleName

Note: Replace ‘ModuleName’ with the module that you actually want to search, install or update using the above-given commands.

Conclusion:

So, using the quick steps given in this tutorial, a user can have the PowerShellGet module installed in their Windows PowerShell environment. It will help you to search and install various different modules that would be quite helpful in your scripting and automation tasks.