Share via

Powershell Win11 Surface - NuGet issue

Alexander Findlay 1 Reputation point
2022-03-22T03:38:10.423+00:00

previously command and NuGet have been working fine, but recently it has stopped and is hindering quite a but of my work.

One instance I am trying to reinstall the Exchange Online V2 module using command: Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.5

This then states that: PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories

Then it asks if you want to Install and import NuGet provider now, I say yes to this then I get: WARNING: Import-PackageProvider failed. Possibly the provider name is different from the package name 'NuGet'. Try
Get-PackageProvider -ListAvailable to identify the associated provider name and run Import-PackageProvider".
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

So I go to check my providers with command: "Get-PackageProvider -ListAvailable" which then proceeds to tell me that the 2.8.5.208 is in fact available
PS C:\WINDOWS\system32> Get-PackageProvider -ListAvailable

Name Version DynamicOptions


msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
nuget 2.8.5.208
PowerShellGet 1.0.0.1 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent

I have seen elsewhere that it may be due to TLS, so I go to check my TLS through powershell:
PS C:\WINDOWS\system32> [Net.ServicePointManager]::SecurityProtocol
SystemDefault

I go to change it with command: [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
PS C:\WINDOWS\system32> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Cannot set property. Property setting is supported only on core types in this language mode.

My OS is set to English (Australian), so I tried changing this to US, no luck, tried restarting and doing it again, no luck

Would greatly appreciate help.

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments

1 answer

Sort by: Most helpful
  1. Limitless Technology 40,106 Reputation points
    2022-03-28T14:26:10.39+00:00

    Hi @Alexander Findlay

    Please try the installation process at the link below:

    https://learn.microsoft.com/en-us/powershell/module/packagemanagement/install-packageprovider?view=powershell-7.2#:~:text=Restart%20PowerShell%20to%20auto%2Dload,the%20current%20Windows%20PowerShell%20session.

    Run Powershell with Admin rights

    Type the below PowerShell security protocol command for TLS12:

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

    I do hope this answers your question.

    Thanks.

    --
    --If the reply is helpful, please Upvote and Accept as answer--

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.