PowerShell/PowerShellGet

Cannot remove compat layer from session

ev-dev opened this issue · 1 comments

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:

  • Latest versions of both PowerShellGet and CompatPowerShellGet are installed & available
  • > Install-Module -Name Pansies -AllowClobber (Output: "WARNING: The cmdlet 'Install-Module' is deprecated, please use 'Install-PSResource'.")
  • > Remove-Module -Name CompatPowerShellGet
  • > Install-Module -Name Pansies -AllowClobber (Same output warning, no operation performed)

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?