1 | [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 |
-Use Install-PackageProvider to install NuGet before installing other modules
Run the following command to install the NuGet provider.
1 | Install-PackageProvider -Name NuGet -Force |
-Let Install-Module prompt you to install the NuGet provider
The following command attempts to install the updated PowerShellGet module without the NuGet provider. Install-PackageProvider -Name NuGet -Force Install-Module prompts you to install the NuGet provider. Type Y to install the provider.
NuGet provider is required to continue PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\user1\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running ' Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y VERBOSE: VERBOSE: Installing NuGet provider.
Note:
If you have not configured TLS 1.2, any attempts to install the NuGet provider and other packages will fail.
After you have installed the new version of PowerShellGet, you should open a new PowerShell session. PowerShell automatically loads the newest version of the module when you use a PowerShellGet cmdlet.
We also recommend that you register the PowerShell Gallery as a trusted repository. Use the following command:
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted