Install NuGet via PowerShell script
- Run Powershell with Admin rights
- Type the below PowerShell security protocol command for TLS12:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Here's a short PowerShell script to do what you probably expect:
$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"$targetNugetExe = "$rootPath\nuget.exe"Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExeSet-Alias nuget $targetNugetExe -Scope Global -Verbose
Note that Invoke-WebRequest
cmdlet arrived with PowerShell v3.0. This article gives the idea.
This also seems to do it.PS Example:
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force