MicrosoftDocs / PowerShell-Docs-PSGet

The official documentation for PowerShellGet and PowerShell Gallery
https://docs.microsoft.com/powershell/gallery/overview
Creative Commons Attribution 4.0 International
26 stars 28 forks source link

Offline repository instructions do not work with Windows Server 2016 #133

Open jwarner777 opened 6 months ago

jwarner777 commented 6 months ago

Type of issue

Other (describe below)

Feedback

These instructions do not work on a windows 2016 server standard edition x64 Desktop Experience. You get a get-packageprovider -listavailable to see if it exists on the system, which it cannot because you get stuck into a catch 22. You can download Nuget manually but since Powershellget and Packagemanager are to old 1.0.0.1 they need updating. To update them you need a newer version of Nuget newer than 2.8.5.201. You can download the NUGET from the website (https://www.nuget.org/downloads) but it wont replace the nuget on the system. Putting in the TLS 1.2 settings does not seem to help. The Nuget package that you download from the nuget site does not have the packagemanagement nor the powershellget packages available to update. The nuget.exe itself will connect and update itself to the latest version but it will not update the version on your windows server 2016 server...where it is residing. Creating a C:\Program Files\PackageManagement\ProviderAssemblies\NuGet\6.9.1.3\Microsoft.PackageManagement.NuGetProvider.dll folder and putting the nuget.exe in there will also not update the systems version of Nuget.

Page URL

https://learn.microsoft.com/en-us/powershell/gallery/how-to/getting-support/bootstrapping-nuget?view=powershellget-3.x

Content source URL

https://github.com/MicrosoftDocs/PowerShell-Docs-PSGet/blob/main/powershell-gallery/docs-conceptual/how-to/getting-support/bootstrapping-nuget.md

Author

@sdwheeler

Document Id

2734fae4-ad3b-7fd5-a4f9-14b03b5c767a

o-l-a-v commented 4 months ago

Maybe this doc should be deprecated and instead show a way to install Microsoft.PowerShell.PSResourceGet on a Windows PowerShell 5.1 only system without using PowerShellGet and PackageManagement? Like downloading the .nupkg file from PowerShell Gallery and extract is like a ZIP to:

One could do the same thing with PowerShellGet and PackageManagement. But why keep using those when we now have PSResourceGet, I don't know.


Edit: Does this work? Run as administrator:

# Set TLS version
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

# Install NuGet for all users
PackageManagement\Install-PackageProvider -Name 'NuGet' -RequiredVersion '2.8.5.208' -Scope 'AllUsers' -Force  -Verbose

Found here: https://stackoverflow.com/questions/51406685/powershell-how-do-i-install-the-nuget-provider-for-powershell-on-a-unconnected.