I installed PowerShell 7.0.0-preview.1 using the msi and there are no package providers available.
I have not uninstalled/reinstalled in case is further information you'd like from the system before I try that.
I suspect this is something to do with Amazon WorkSpaces. The three Windows 10 Amazon WorkSpaces environments I've installed the above linked MSI on have no package providers available.
The one standard Windows 10 desktop I installed the MSI on has the two default package providers.
??
PS>Get-PackageProvider
Name Version DynamicOptions
---- ------- --------------
NuGet 3.0.0.1 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, …
PowerShellGet 2.1.2.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, In…
PS>
PS C:\> Get-PackageProvider
PS C:\>
PS>$PSVersionTable
Name Value
---- -----
PSVersion 7.0.0-preview.1
PSEdition Core
GitCommitId 7.0.0-preview.1
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS>Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object Caption,Version
Caption Version
------- -------
Microsoft Windows 10 Enterprise 10.0.18362
PS>(Get-PackageProvider).Count
0
I'm seeing the same behaviour of no package providers being available to the PS 7 preview even though PS 6.2.1 and Windows PowerShell can see and use the providers. I'm using a standalone Windows 10 laptop so Amazon Web services (as reported above) isn't an issue for me
```
PS> $PSVersionTable
Name Value
---- -----
PSVersion 7.0.0-preview.1
PSEdition Core
GitCommitId 7.0.0-preview.1
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
Came across something like this yesterday on a new install.
After attempting to run any powershelllget or PackageManagement command, run this and check the result:
Get-Module | Select Name, ModuleBase
For me, I saw PS loading these modules from C:\Program Files\PowerShell\Modules
before the ones in the PowerShell7-preview\modules
folder.
For whatever reason I had old versions in that folder, which failed to work pretty much at all, but mostly very quietly failing like this.
Deleting the ones in the generic folder allowed it to use the ones in its own folders which worked for me.
Thanks @vexx32 - while that wasn't the case for me it did give me something to look at... and good news.
The issue for me has been solved by removing the PackageManagement module from my user PS Module path. I had pre-1.4 versions of PackageManagement which was breaking PowerShell 7.0-preview.1.
As soon as I removed PackageManagement and re-launched PowerShell 7.0-preview.1 the PackageProviders started working as expected.
Before
PS>Get-Module -Name PackageManagement -ListAvailable | Select Name,Version,ModuleBase
Name Version ModuleBase
---- ------- ----------
PackageManagement 1.3.1 D:\Users\<username>\Documents\PowerShell\Modules\PackageManagement\1.3.1
PackageManagement 1.2.4 D:\Users\<username>\Documents\PowerShell\Modules\PackageManagement\1.2.4
PackageManagement 1.2.3 D:\Users\<username>\Documents\PowerShell\Modules\PackageManagement\1.2.3
PackageManagement 1.4 C:\program files\powershell\7-preview\Modules\PackageManagement
PS>Get-PackageProvider
PS>
After
PS>Get-Module -Name PackageManagement -ListAvailable | Select Name,Version,ModuleBase
Name Version ModuleBase
---- ------- ----------
PackageManagement 1.4 C:\program files\powershell\7-preview\Modules\PackageManagement
PS>Get-PackageProvider | Select Name,Version
Name Version
---- -------
NuGet 3.0.0.1
PowerShellGet 2.1.4.0
Awesome!
@SteveL-MSFT is there anything we can do with respect to this sort of issue? I feel as though anyone coming from PS 6.x to PS 7 risks running into the same issues.
@vexx32 That solved the issue I had. Thank you
Hmmm, don't see an obvious fix here. We prioritize modules from the user folder first.
Changing the current behavior to load newest module irregardless of the priority in $env:PSModulePath
is a breaking change and likely to impact a number of customers that wanted to use a specific version.
We could print out a warning message if we import a module that isn't the latest one, but there's a perf impact to any change that has to gather all the versions to determine if it's latest.
The specific issue here with PkgMgmt is that a change in .NET Core 3.0 broke PkgMgmt due to a bug in PkgMgmt which required a change.
Yeah, I'm wondering if, since we _know_ for a fact that lower versions of PkgMgmt won't work, is there some way we can set a minimum version for PS7 for those modules?
@vexx32 you can declare a module to require a minimum version of PowerShell, but can't declare a minimum version of a module for PowerShell. I would hate to special case this within PS7. Seems like what we need is a way to notify users they have an outdated version of a module. I'll add this to my PSGet3 RFC. I'm open to other ideas to help users here as documentation is probably not sufficient.
I ran into this issue today with PS7 on 1909 (fresh install of PS7 GA version) @SteveL-MSFT @vexx32
This was fixed by removing the old version PackageManagement folder from C:\Users\Username\Documents\PowerShell\Modules
Hi Everyone. I am having a similar issue. PS7 is my first PS Core install on my system. I don't have any packagemanagement modules in the user directory but get-package shows nothing for me in PS7. Here is my windows powershell output:
Get-Module packagemanagement -ListAvailable
Directory: C:\Program Files (x86)\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.4.6 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script 1.4.5 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Any suggestions on how to get these cmdlets working in PS7 is greatly appreciated.
if you remove the pre-1.4 versions of PackageManagement in those paths (just delete the folders) it should be usable from that state I think. 🙂
I tried deleting the PackageManagement folders and still don't get any results in PS7. I also tried deleting just the 1.0.0.1 folder but that still didn't work. Removing both packagemanagement folders also breaks powershell get thus making it difficult to reinstall packagemanagement.
In PS7, get-module shows only v1.4.6. I tried manually importing it. No errors were received but get-package still shows nothing and only nuget and powershellget show up as package providers.
Those would be the package providers I'd expect to see. Are you expecting something else to show up as well?
Get-Package
will only show something if you've installed something from an online source. If it's returning nothing, it isn't seeing anything installed that way.
Try using Find-Module
to see if you can find a module from the PSGallery and/or Install-Module
to see if installation is working for you. 🙂
OK maybe this is a noob PSCore issue then. I have lots of windows powershell scripts that use get-package and uninstall-package. The provider is mostly msi, msu, and programs. Those providers paths in windows powershell are in C:\Program Files\WindowsPowerShell\Modules\PackageManagement. 1.4.6 is the latest on psgallery. If I import this module into PS7, still those providers do not show up as being available.
PS C:\Windows\System32> Get-PackageProvider -ListAvailable
Name Version DynamicOptions
---- ------- --------------
NuGet 3.0.0.1 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, …
PowerShellGet 2.2.3.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, In…
PowerShellGet 1.0.0.1
Ah, I gotcha. I'm actually not sure if those providers are _supposed_ to be supported in pwsh going forward. Some / all of that is going to be using Windows-specific APIs, so I would expect some or all of them to be missing in PowerShell 6+
@SteveL-MSFT are you able to confirm whether the msi
, msu
, or Programs
providers are supposed to be accessible from pwsh?
Ok. I saw packagemanagement in the list of natively supported windows management modules but maybe you are right about it not including support for all the providers.
@SydneyhSmith / @alerickson are these providers supposed to be available on PS Core?
Most helpful comment
Thanks @vexx32 - while that wasn't the case for me it did give me something to look at... and good news.
The issue for me has been solved by removing the PackageManagement module from my user PS Module path. I had pre-1.4 versions of PackageManagement which was breaking PowerShell 7.0-preview.1.
As soon as I removed PackageManagement and re-launched PowerShell 7.0-preview.1 the PackageProviders started working as expected.
Before
After