Senior Systems Engineer
Senior Systems Engineer

Reputation: 1155

Unable to Install NuGet on newly installed Windows Server 2016 as Administrator?

I'm using Windows Server 2016 and ADFS 4.0.

As part of the troubleshooting AD Federation service, which requires me to install the NuGet and the Modules as per https://adfshelp.microsoft.com/diagnosticsanalyzer/Analyze

This is what I have executed and the error:

Install-Module -Name ADFSToolbox -Force
Import-Module -Name ADFSToolbox -Force
Install-PackageProvider -name NuGet -MinimumVersion 2.8.5.201 -Force

Error:

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.
PackageManagement\Import-PackageProvider : No match was found for the specified search criteria and provider name 'NuGet'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Get-PackageProvider : Unable to find package provider 'NuGet'. It may not be imported yet. Try 'Get-PackageProvider -ListAvailable'.

Install-Module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed.
Import-Module : The specified module 'ADFSToolbox' was not loaded because no valid module file was found in any module directory.

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.

The script above was executed via Powershell ISE Run as Administrator with login as domain admins.

Upvotes: 4

Views: 10211

Answers (2)

Chris Rust
Chris Rust

Reputation: 11

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Works just as well if you are in the System you're running the command from. Also, you can check to see if it installed by checking typing:

[Net.ServicePointManager]::SecurityProtocol

It should return the value:

C:\> Tls12

Upvotes: 1

dwillits
dwillits

Reputation: 313

Force PowerShell to use TLS 1.2, and then execute your commands. I ran into this issue after the cutoff date for TLS 1:

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;

Upvotes: 13

Related Questions