PowerShell / PowerShellGet

This module provide functions used with PowerShellGet v3 to provide compatibility with scripts expecting PowerShellGet v2
MIT License
49 stars 13 forks source link

Cannot remove compat layer from session #18

Open ev-dev opened 2 years ago

ev-dev commented 2 years ago

Using Remove-Module CompatPowerShellGet does not disable the compatibility mapping features for the PS session. Attempts to run Install-Module after removing the compat module still fails with deprecated warnings.

Recent PS blog post mentions the ability to temporarily bypass the compatibility features of this module.

If you have this compatibility module installed and would not like it to be used, you can remove it from the PowerShell session using the Remove-Module command.

Steps to reproduce:

jpawlowski commented 2 years ago

Good point!

As PowerShellGet V3 has a few issues right now installing quite a lot famous Microsoft 365 PS modules (Exchange Online, MS Teams, PnP PowerShell, …), it is not possible to use CompatPowerShellGet at the moment. This is due to the fact that to install these modules, one still needs to use the Install-Module command from PowerShellGet V2 until a fix for this was introduced (hopefully as part of v3.0.14-beta, but there is v3.0.13-beta first…).

There is a workaround described here:

Please also note that this compatibility module will not be called if you use fully qualified cmdlets. For example, if you use PowerShellGet\Install-Module this will call a legacy version of PowerShellGet.

However, this workaround does not seem to work. Not sure this is a bug or something I'm doing wrong.

Any hints or tipps what needs to be done, besides not installing CompatPowerShellGet?