PowerShellGet is a module with commands for discovering, installing, updating, and publishing PowerShell artifacts like Modules, Scripts, and DSC resources.
PowerShellGet version 1.0.0.1 preinstalled with Windows PowerShell 5.1. However, this version of PowerShellGet has limited features and doesn’t support the updated capabilities of the PowerShell Gallary.
In the article, we will discuss how to install the latest version of the PowerShellGet module, install a specific version of the PowerShellGet module, and update the PowerShellGet preinstalled version.
System Requirements to Install PowerShellGet
The PowerShellGet module requires .NET Framework 4.5 to be installed on the system. If you don’t have .NET Framework, see how to install the .NET Framework.
PowerShell Gallary no longer supports Transport Layer Security (TLS) versions 1.0 and 1.1. If you are not using TLS version 1.2, you will get an error while trying to access the PowerShell Gallary.
Use the following command to enable the TLS 1.2 version in your PowerShell session.
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
How to Install the PowerShellGet Module
PowerShellGet modules come as preinstalled modules with the PowerShell version.
To install the latest version of the PowerShellGet module, open the PowerShell terminal with Run as administrator to start an elevated session.
Step 1: Use Install-PackageProvider
to install NuGet before the installation of other modules.
To install the Nuget Provider, run the following command
Install-PackageProvider -Name NuGet -Force
Step 2: Use the Install-Module
cmdlet to install the PowerShellGet module. It will install the latest version of PowerShellGet
Install-Module PowerShellGet -AllowClobber -Force
Step 3: Close the PowerShell terminal and open a new PowerShell session.
After you have installed the PowerShellGet module to its latest version, open a new PowerShell session. It will automatically load the latest version of the modules.
How to Install Specific Version of PowerShellGet Module
To install a specific version of the PowerShell module like version 2.2.5, run the following command.
Install-Module -Name PowerShellGet -RequiredVersion 2.2.5 -Force
How to Update PowerShellGet Module
To update the PowerShellGet module to the latest version of 2.2.4, use the Update-Module
cmdlet and provide the module name.
Run the following command to update the PowerShellGet
module to the latest version.
Update-Module -Name PowerShellGet
After you have updated the PowerShellGet module to its latest version, open a new PowerShell session. It will automatically load the latest version of the modules.
Conclusion
I hope the above article on how to install the latest version of the PowerShellGet module is helpful to you.
Use the Install-Module
and Update-Module
commands to install and update the PowerShellGet module.
You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.