question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

3.0.12-beta | Update-PSResource reinstalls modules installed by pre v3 PowerShellGet, even though there is no new version

See original GitHub issue

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Option one

Import-Module -Name 'PowerShellGet' -RequiredVersion '3.0.12'
Update-PSResource -Scope 'AllUsers' -Repository 'PSGallery' -Verbose

Option two

# Install a module with PowerShellGet v2.2.5
Import-Module -Name 'PowerShellGet' -RequiredVersion '2.2.5'
Uninstall-Module -Name 'AzureRM.LogicApp' -AllVersions
Install-Module -Name 'AzureRM.LogicApp' -Scope 'AllUsers' -Repository 'PSGallery' -Force

# Check if PowerShellGet v2.2.5 will update it.
# It righfully returns that no update is available.
Update-Module -Name 'AzureRM.LogicApp' -Scope 'AllUsers' -Verbose

# Import PowerShellGet v3.0.12-beta
Remove-Module -Name 'PackageManagement','PowerShellGet','PSReadline' -Force
Import-Module -Name 'PowerShellGet' -RequiredVersion '3.0.12'

# Check if PowerShellGet v3.0.12-beta will update the module in question, once.
# Installs AzureRM.LogicApp _and_ AzureRM.Profile, same versions that are already installed.
Update-PSResource -Name 'AzureRM.LogicApp' -Scope 'AllUsers' -Verbose # 

# Check if PowerShellGet v3.0.12-beta will update the module in question, twice.
# It righfully returns that no update is available.
Update-PSResource -Name 'AzureRM.LogicApp' -Scope 'AllUsers' -Verbose # Says no update available

Expected behavior

Only modules and scripts where a newer version is available on PSGallery should be updated.

Actual behavior

Seems PowerShellGet v3 reinstalls modules installed by PowerShellGet v2, not caring if there is actually a newer version?

Error details

There is no error.

Environment data

* PowerShellGet v3.0.12-beta
* Windows 10 21H2 / 19044.1586
* Windows PowerShell 5.1 terminal

Visuals

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
SydneyhSmithcommented, Mar 31, 2022

Thanks @o-l-a-v we were able to reproduce this and digging in a bit it seems like it might be a scoping issue specific to AllUsers…we’ve added this to the project we are working on now

1reaction
o-l-a-vcommented, Mar 28, 2022

I’ve made no modifications to that variable, nor do I use a custom profile.

C:\Program Files (x86)\Microsoft Azure Information Protection\Powershell
C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin
C:\Program Files (x86)\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\Users\birola\OneDrive - <company>\Dokumenter\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

The OneDrive folder is because of OneDrive for Business Known Folder Move. There are no modules installed to that folder.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Use Newer Version of PowerShellGet in ...
I need to install the prerelease commands for MgGraph. To do that I need to use the -allowprerelease parameter for Install-Module , which...
Read more >
Unable to update PowerShellGet , error: The version '1.4.7' ...
I was able to fix this by running the command below in an admin PowerShell: Update-Module -Name PowerShellGet -RequiredVersion 2.2.5.1.
Read more >
PowerShellGet 3.0.12-beta
Version Downloads Last updated 3.0.21‑beta21 10,432 2 months ago 3.0.20‑beta20 6,387 4 months ago 3.0.19‑beta19 57,765 6 months ago
Read more >
What is PowerShellGet and How to Install PowerShellGet 3.0
PowerShellGet is a PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like ...
Read more >
[3.0.0-beta10] Install-Module fails with OneDrive - Access ...
Repo steps: Install PowerShellGet 2.2.5; Run Install-Module <any module>; Receive error PackageManagement\Install-Package : Access ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found