Skip to content

PowerShell installer wipes and replaces shortcut even if nothing was changed in the executable path name or arguments #21466

@R-Adrian

Description

@R-Adrian

Prerequisites

Steps to reproduce

  1. install version 7.4.1 of PowerShell 7 (i.e. the previous one)
  2. go to the folder C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PowerShell\
  3. edit the PowerShell 7 (x64) shortcut's advanced properties and set the 'run as administrator' checkbox. Save the shortcut properties. (with elevation confirmation prompt too)
  4. test that PowerShell 7 now requires elevation by default when starting from Start Menu
  5. make sure pwsh 7 is not running, start an elevated cmd.exe command prompt, run winget upgrade Microsoft.PowerShell - and update pwsh to version 7.4.2 ( https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/PowerShell-7.4.2-win-x64.msi )
  6. now check that shortcut again

Expected behavior

expected behaviour: when upgrading do not mess with existing shortcuts if the executable shortcut path and arguments are correct for the new version, maybe show a confirmation prompt window about replacing them and let the user decide?

alternative expected behaviour, especially when doing silent / unattended upgrades: do not modify already working shortcuts.

Actual behavior

PowerShell installer nuked the old shortcut and created a new one in its place, without the advanced properties that the old shortcut had and did this replacement even if nothing has changed in the executable's path name or arguments.

Error details

(installation issue, not an actual pwsh error)

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions