GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove duplicate `Open Here` context menu item upgrading to newer Preview release by SteveL-MSFT · Pull Request #8496 · PowerShell/PowerShell

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Dec 20, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

PR Summary

Explicitly remove the old Open regkey that enabled the Open Here context menu functionality as it was renamed to OpenPwsh and MSI didn't automatically remove the old key.

Christoph Bergmeister (@bergmeister) can you help review as Travis Plunk (@TravisEz13) is on vacation currently

Fix #8290

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Change is not breaking
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready.
  • User-facing changes
    • Not Applicable
    • OR
    • User-facing Documentation needed
      • Issue filed - Issue link:
  • Testing - New and feature
    • Not Applicable or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed
      • Add [feature] if the change is significant or affects feature tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sba923 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@SteveL-MSFT Steve Lee (SteveL-MSFT) assigned Ilya (iSazonov) Dec 20, 2018
@SteveL-MSFT
Steve Lee (SteveL-MSFT) requested a review from Travis Plunk (TravisEz13) December 20, 2018 00:56
Steve Lee (POWERSHELL)
[package]
6b4c86b
remove old `Open` regkey
@SteveL-MSFT
Steve Lee (SteveL-MSFT) force-pushed the msi-open-here branch from 4fc3ed1 to 6b4c86b Compare December 20, 2018 00:56
bergmeister
Christoph Bergmeister (bergmeister) approved these changes Dec 20, 2018
View reviewed changes

@bergmeister Christoph Bergmeister (bergmeister) left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Looks ok to me from a code perspective, a manual test for the 2 scenarios (old context menu does exist or not) would not hurt though. Thanks for taking on the effort for this.

About the issue itself:

  • I have seen the start menu failing to uninstall in one of the 6.1 previews, which I believe is the root cause to be of the reported issue.
  • When I did the PR to tweak the registry setting to fix a subtle bug with it, I manually tested multiple upgrade scenarios by building 2 installers of different minor version and upgrading from one to the other and there was no issue. Therefore I suspect that maybe the simplification of the installation path to just have the simple version number 6 broke that uninstall functionality on upgrade or something similar that impacted the whole installer? It would be interesting to construct a 6.2 installer and upgrade from an actual 6.1 RTM installer to test this scenario more realisticaly and verify this is actually an issue and not an intermittent issue in one of the previews (the nature of previews is simply that one should expect that sometimes something gets left over). This is the only reason why I have a bit of an odd feeling about adding such code but I'm OK with it if that's your preference.
  • Given the recent upgrade issue with shared components across RTM and preview, this could've also been a potential culprit. In PR #7701 I fixed for example the long standing issue where the shortcut did not get removed when RTM and preview were installed, which was due to the component GUID being shared and not unique. All of that just shows the potential of where upgrades can go wrong, maybe it would be better to recommend to always uninstall and re-install PowerShell (and potentially even disable upgrade?) if the expense of upgrade problems/maintenance outweighs the simplicity of upgrades? Since WiX is being developed by MSFT, maybe an internal code review of the whole installer from experts like Rob Mensching (Github handle: @robmen) would be a good long term investment.
  • What kind of upgrade scenarios will PowerShell support? Just upgrading one minor or multiple patch versions at a time? Or multiple minor versions like e.g. 6.0.5 -> 6.3.1? If there was a limitation then one could limit the lifetime of such workarounds to avoid accumulating a lot of those things over time.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SteveL-MSFT

Steve Lee (SteveL-MSFT) commented Dec 20, 2018

Copy link
Copy Markdown
Member Author

Christoph Bergmeister (@bergmeister) thanks for looking into this. Our plan is to move to MSIX (post 6.2) so I don't think we want to spend a bunch of time trying getting things perfect now.

bergmeister reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iSazonov
Ilya (iSazonov) reviewed Dec 20, 2018
View reviewed changes
Comment thread assets/Product.wxs Resolved

Uh oh!

There was an error while loading. Please reload this page.

iSazonov
Ilya (iSazonov) approved these changes Dec 20, 2018
View reviewed changes
@SteveL-MSFT

Steve Lee (SteveL-MSFT) commented Dec 27, 2018

Copy link
Copy Markdown
Member Author

Ilya (@iSazonov) I think we're good to merge this one

bergmeister reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov
Ilya (iSazonov) merged commit e787027 into PowerShell:master Dec 27, 2018
@iSazonov Ilya (iSazonov) added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Jan 17, 2019
@bergmeister Christoph Bergmeister (bergmeister) mentioned this pull request Jun 6, 2019
Uninstall problem(context menu was not removed) #7826
Closed
@Karl-WE

Karl Wester-Ebbinghaus (Karl-WE) commented Oct 13, 2019

Copy link
Copy Markdown

This issue will still affect users that upgrade to the latest PoSh Core 6.2.x and once had a preview release.
It will also not be cleared for those that upgrade any PoSh Core Preview.

Suggestion
please implement a cleanup with the next release of PoSH 6.x or 7.x, no matter if the user checks the explorer integration
The MSI can check if preview-6 is still installed by wmi check and directory check on
C:\Program Files\PowerShell\6-preview

if the directory and WMI call results there is no 6 preview installed cleanup should purge the orphaned registry keys.

image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Oct 13, 2019

Copy link
Copy Markdown
Collaborator

Karl Wester-Ebbinghaus (@Karl-WE) If I remember correctly a conclusion was to do not fix the old and rare issue. Also taking in account how msi works it is not easy.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Karl-WE

Karl Wester-Ebbinghaus (Karl-WE) commented Oct 13, 2019

Copy link
Copy Markdown

I have searched the entire registry for
"PowerShell 6-preview" but no finds.

How can we remove this manually?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Oct 14, 2019

Copy link
Copy Markdown
Collaborator

Yes, of cause. You need to search "pwsh.exe"

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister

Christoph Bergmeister (bergmeister) commented Oct 14, 2019

Copy link
Copy Markdown
Contributor

The registry keys are here:

PowerShell/assets/Product.wxs

Line 186 in bf59561

<Component Id="ExplorerContextMenu" Guid="{df82e941-fced-4de9-aef8-c81a2946dd68}" KeyPath="yes">

Alternatively, you can also just install a preview of 6 again with the explorer context menu again and uninstall it explicitly, which will always remove the registry entries, it is just the case of using an upgrade install, which can leave registry entries behind. I agree with Ilya (@iSazonov) that we should not need to invest effort for more polished previews, that's just the nature of previews (saving time for the dev team to get early feedback without having to invest time in proper support).

Karl-WE reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the msi-open-here branch October 14, 2019 16:27
@Karl-WE

Karl Wester-Ebbinghaus (Karl-WE) commented Oct 15, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Hi all I've made a script to remove this issue. It worked for me, hope it can help others.

Cleanup-PowershellCoreOrphans.zip

Tried to paste the code here but formatting didn't worked out as I expected so sorry for the zip file.

iSazonov, lelinhtinh, and gzayatz reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sba923

Stéphane BARIZIEN (sba923) commented May 18, 2020

Copy link
Copy Markdown
Contributor

I wrote something similar that will remove entries for all PowerShell versions that are no longer installed. Hope this helps.

Remove-PowerShellOpenWithEntries.zip

Karl-WE and o-l-a-v reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@o-l-a-v

Olav Rønnestad Birkeland (o-l-a-v) commented Aug 28, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

I too made a little PowerShell script to clean up right click context menus.
Run with -WriteChanges to actually remove anything.

Click to expand
#Requires -RunAsAdministrator
<#
    .SYNOPSIS
        Clean up right click context menu.

    .NOTES
        Author:   Olav Rønnestad Birkeland
        Created:  210828
        Modified: 210828

    .EXAMPLE
        # Git
        & $psISE.'CurrentFile'.'FullPath' -NamesLike 'git*'
        & $psISE.'CurrentFile'.'FullPath' -NamesLike 'git*' -WriteChanges
        # Intel Graphics Settings
        & $psISE.'CurrentFile'.'FullPath' -NamesLike 'igfx*'
        & $psISE.'CurrentFile'.'FullPath' -NamesLike 'igfx*' -WriteChanges
        # MPC-HC
        & $psISE.'CurrentFile'.'FullPath' -NamesLike 'mplayerc64.*'
        & $psISE.'CurrentFile'.'FullPath' -NamesLike 'mplayerc64.*' -WriteChanges
        # nVidia Graphics Settings
        & $psISE.'CurrentFile'.'FullPath' -NamesLike 'NvCplDesktopContext'
        & $psISE.'CurrentFile'.'FullPath' -NamesLike 'NvCplDesktopContext' -WriteChanges
        # PowerShell 7 Preview
        & $psISE.'CurrentFile'.'FullPath' -NamesLike 'PowerShell7-preview*'
        & $psISE.'CurrentFile'.'FullPath' -NamesLike 'PowerShell7-preview*' -WriteChanges
#>


# Input parameters
[OutputType($null)]
Param(
    [Parameter(Mandatory, HelpMessage = 'String array of PowerShell -like statements to match with.')]
    [string[]] $NamesLike,

    [Parameter(HelpMessage = 'Whether to write changes.')]
    [switch] $WriteChanges
)


# PowerShell preferences
$ErrorActionPreference = 'Stop'
$InformationPreference = 'Continue'


# Assets
$Paths = 


# Loop through
$(
    [string[]](
        'HKEY_CLASSES_ROOT'
    )
).ForEach{
    [string[]](
        # Directory
        ('Registry::{0}\Directory\Background\shell' -f $_),
        ('Registry::{0}\Directory\Background\shellex\ContextMenuHandlers' -f $_),
        ('Registry::{0}\Directory\ContextMenus' -f $_),
        ('Registry::{0}\Directory\shell' -f $_),
        ('Registry::{0}\Directory\shellex\ContextMenuHandlers' -f $_),
        ('Registry::{0}\Directory\shellex\DragDropHandlers' -f $_),
        # Drive
        ('Registry::{0}\Drive\shell' -f $_),
        ('Registry::{0}\Drive\shellex\ContextMenuHandlers' -f $_),
        ('Registry::{0}\Drive\shellex\DragDropHandlers' -f $_),
        # Library folder
        ('Registry::{0}\LibraryFolder\background\shell' -f $_),
        ('Registry::{0}\LibraryFolder\background\shellex\ContextMenuHandlers' -f $_),
        ('Registry::{0}\LibraryFolder\ShellEx\ContextMenuHandlers' -f $_)
    )
}.ForEach{
    Get-ChildItem -Path $_ -Depth 0
}.'PSPath'.Where{
    $(
        foreach ($NameLike in $NamesLike) {
            $_.Split('\')[-1] -like $NameLike
        }
    ) -contains $true
}.ForEach{
    Write-Information -MessageData $_
    if ($WriteChanges) {
        if (Test-Path -Path $_) {
            $null = Remove-Item -Path $_ -Recurse -Force
            Write-Information -MessageData ('{0}Successfully removed.' -f "`t")
            $null = Start-Sleep -Milliseconds 100
        }
        else {
            Write-Information -MessageData ('{0}Already removed.' -f "`t")
        }
    }
}
Karl-WE reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Karl-WE

Karl Wester-Ebbinghaus (Karl-WE) commented Aug 28, 2021

Copy link
Copy Markdown

Hi Steve Steve Lee (@SteveL-MSFT) do you think one these scripts could be included in the MSI? Not sure about Win11 as so far the integration due Windows Terminal is better and context menu only includes Terminal by default.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@SteveL-MSFT @iSazonov
Remove duplicate Open Here context menu item upgrading to newer Pre…
3420a3f
…view release (PowerShell#8496)

Remove old `Open` regkey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iSazonov Ilya (iSazonov) iSazonov approved these changes
@TravisEz13 Travis Plunk (TravisEz13) Awaiting requested review from TravisEz13
+1 more reviewer
@bergmeister Christoph Bergmeister (bergmeister) bergmeister approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@iSazonov Ilya (iSazonov)

Labels

CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

PowerShell-6.2.0-preview.2-win-x64 creates duplicate "Open here" context menu item (also preview.3)

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@SteveL-MSFT @Karl-WE @iSazonov @bergmeister @sba923 @o-l-a-v
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.