Skip to content

Upgrading PWSH via winget running in PWSH is a pain #27031

@WillPittenger

Description

@WillPittenger

Prerequisites

Steps to reproduce

  1. Install a slightly older PowerShell like 7.4.
  2. Open a PowerShell instance using the freshly installed copy of PWSH. I was using the latest Windows Terminal.
  3. Run winget update -i microsoft.powershell.
  4. Note the installer wants open PWSH instances to be closed.

How do you close the instance of PWSH that's running the installer without closing the installer? It'd help if the installer could detect it's running by winget in PWSH. Then it could rerun itself so the PWSH instance could be closed.

Expected behavior

The installer should be able to upgrade itself smoothly even if it's being run by a PWSH that locks the executable it needs to replace.

Actual behavior

I've tried to close the terminal containing the PWSH instance running the installer. That closes the installer too. I then had to manually uninstall PWSH and install the new version with a fresh download from GitHub.

Error details

Environment data

PS C:\Users\willp> $PSVersionTable

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

Visuals

I'll try that if I remember next time PWSH needs to be updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.Review - MaintainerThe PR/issue needs a review from the PowerShell repo Maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions