Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silent Update removes context menu entry if previously added #16886

Closed
5 tasks done
awsr opened this issue Feb 15, 2022 · 21 comments · Fixed by #20420
Closed
5 tasks done

Silent Update removes context menu entry if previously added #16886

awsr opened this issue Feb 15, 2022 · 21 comments · Fixed by #20420
Labels
Area-Maintainers-Build specific to affecting the build In-PR Indicates that a PR is out for the issue Issue-Enhancement the issue is more of a feature request than a bug

Comments

@awsr
Copy link

awsr commented Feb 15, 2022

Prerequisites

Steps to reproduce

  1. Have PowerShell installed with the context menu entry added from the Add 'Run with PowerShell 7' context menu for PowerShell files option in the installer. *
  2. Update PowerShell to the latest version via Windows Update.

Expected behavior

Installer sees existing "Run with PowerShell 7" context menu entry and retains it after the update.

Actual behavior

Installer removes context menu entry and installs the new version with default settings only (without context menu entry).

Error details

No response

Environment data

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

Visuals

* Referring to this option:
Installer option

@awsr awsr added the Needs-Triage The issue is new and needs to be triaged by a work group. label Feb 15, 2022
@iSazonov iSazonov added the Area-Maintainers-Build specific to affecting the build label Feb 16, 2022
@iSazonov
Copy link
Collaborator

Do you ask the option must be On if previously it was On?

@awsr
Copy link
Author

awsr commented Feb 16, 2022

The option was originally on. That image is just an example from a different issue that I used to show which option I'm referring to.

When I installed PowerShell 7.2.0, I enabled that option for the context menu. Ideally, that choice would be taken into account when updating.

@TravisEz13 TravisEz13 changed the title Updating via Windows Update removes context menu entry if previously added Updating via Microsoft Update removes context menu entry if previously added May 16, 2022
@TravisEz13
Copy link
Member

Does this happen through any silent MSI upgrade?

@ignant1
Copy link

ignant1 commented May 19, 2022

Upgrading through winget removes the context menu.

Getting it from the Windows Store, it installs a separate version if you previously installed via other means. It also does not give you the option add that context menu on the initial installation via the Windows Store, so there is no way to see if upgrading it remove it from the menu.

@TravisEz13 TravisEz13 changed the title Updating via Microsoft Update removes context menu entry if previously added Silent Update removes context menu entry if previously added May 19, 2022
@TravisEz13 TravisEz13 added Issue-Enhancement the issue is more of a feature request than a bug and removed Needs-Triage The issue is new and needs to be triaged by a work group. labels May 19, 2022
@ignant1
Copy link

ignant1 commented Jun 3, 2022

I just installed Visual Studios 2019 which also added "Developer PowerShell for VS 2019" and now the "Run with PowerShell 7" Context Menu is gone. On top of this, uninstalling PowerShell 7 and then reinstalling it and checking the box to add the context menu still does not add it again.

@pat0026
Copy link

pat0026 commented Jul 2, 2022

Still encountered this issue after updating from 7.2.4 to 7.2.5 via windows update. The context menu was gone, this could be fixed by manually tampering with registries but normal users should avoid this. Hope this issue will soon be fixed.

@marcoz-tsn
Copy link

Still encountered this issue after updating from 7.2.4 to 7.2.5 via windows update. The context menu was gone, this could be fixed by manually tampering with registries but normal users should avoid this. Hope this issue will soon be fixed.

same problem here... !

@dgiesselbach
Copy link

dgiesselbach commented Sep 29, 2022

Bug is still existing! We are running 7.2.4 (installed via silent msi with ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1) and after updating via windows update or winget to 7.2.6 context menu is away!

Is a fix in progress?

@RanMLiang
Copy link

Have the same issue.
After updating Powershell 7 via Windows updates, the options for PoweShell 7 are disappeared on the system right-click menu list.
Currently, I have to manually download and install the latest verision of PoweShell 7 every time instead of using Windows updates.

@MdHusainhfz
Copy link

MdHusainhfz commented Nov 6, 2022

Same issue,
I've installed Powershell 7.2.7 with context menu option,
then updated Windows 10 from 21H2 to 22H2, after that Powershell context menu disappeared.

@DesertBear
Copy link

DesertBear commented Dec 13, 2022

Still happening with 7.3.1.

I've been manually updating PowerShell 7 from the GitHub MSI installer to avoid this issue, however today I installed the Windows 10 "Patch Tuesday" updates and it automatically updated PowerShell from 7.3.0 to 7.3.1 at the same time. Therefore, I've now lost the right-click "Run with PowerShell 7" context menu.

@RealLKrieger
Copy link

For me the same as in the post before. I started a deployment of 7.3.0 on a decent amount of systems with the context enabled. Does work until the auto update from wsus with 7.3.1 rolls over, then its gone.

@Bidthedog
Copy link

Bidthedog commented Apr 6, 2023

I just did a reboot and noticed this has happened to me too. I use this context menu constantly. Win 11 on PS v7.3.3. here.

It's not entirely clear what has been installed to make this happen; I assume a windows update or a background update to PowerShell itself?

I have decided to uninstall it, and reinstall it with the auto-update disabled.

@patriml
Copy link

patriml commented Jul 27, 2023

Silent update from PowerShell v7.3.4 to v7.3.5 on Windows 10.0.19045 removed context menu entries for me too. Updating to v7.3.4 via MSI (enabling the option to add context menu entries) restored them.

@aleferri
Copy link

Keep happening to 7.3.6. Please resolve, or be honest and just disable the option of updating automatically as it doesn't work and there is no point on fooling the users.

@DreamCatcher13
Copy link

disappeared for me too, after silent update :( win 10, powershell 7.3.7

@awsr
Copy link
Author

awsr commented Sep 28, 2023

An interesting update. I've found that if I manually add the registry entries for the "Run With PowerShell 7" command instead of re-running the installer to add it, the setting will persist through upgrades. (This does mean I'll have to manually change the references to PowerShell 8 if this is still an issue by the time it comes out.)

The relevant lines for ALL of the registry entries in the installer setup are at:

<Component Id="ExplorerContextMenu">
<Condition>ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL</Condition>
<!-- When clicking on background in Explorer -->
<RegistryKey Root="HKCR" Key="Directory\Background\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
<RegistryValue Type="string" Name="Icon" Value="[VersionFolder]pwsh.exe"/>
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)" KeyPath="yes"/>
</RegistryKey>
<!-- When clicking on Drive in Explorer -->
<RegistryKey Root="HKCR" Key="Drive\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
<RegistryValue Type="string" Name="Icon" Value="[VersionFolder]pwsh.exe"/>
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
</RegistryKey>
<!-- When clicking on Desktop background in Explorer -->
<RegistryKey Root="HKCR" Key="DesktopBackground\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
<RegistryValue Type="string" Name="Icon" Value="[VersionFolder]pwsh.exe"/>
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
</RegistryKey>
<!-- When clicking on folder in Explorer -->
<RegistryKey Root="HKCR" Key="Directory\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
<RegistryValue Type="string" Name="Icon" Value="[VersionFolder]pwsh.exe"/>
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
</RegistryKey>
<!-- When being in a Library folder in Explorer -->
<RegistryKey Root="HKCR" Key="LibraryFolder\background\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
<RegistryValue Type="string" Name="Icon" Value="[VersionFolder]pwsh.exe"/>
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
</RegistryKey>
<!-- Sub menus to open PowerShell at the current location either as a normal shell or as Administrator -->
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\openpwsh">
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextSubMenuDialogText)"/>
<RegistryValue Type="string" Name="Icon" Value="[VersionFolder]pwsh.exe"/>
</RegistryKey>
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\openpwsh\command">
<RegistryValue Type="string" Value="[VersionFolder]pwsh.exe -NoExit -RemoveWorkingDirectoryTrailingCharacter -WorkingDirectory &quot;%V!&quot; -Command &quot;$host.UI.RawUI.WindowTitle = '$(var.ProductName) $(var.SimpleProductVersion) ($(sys.BUILDARCH))'&quot;"/>
</RegistryKey>
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\runas">
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextSubMenuElevatedDialogText)"/>
<RegistryValue Type="string" Name="Icon" Value="[VersionFolder]pwsh.exe"/>
<RegistryValue Type="string" Value="" Name="HasLUAShield"/>
</RegistryKey>
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\runas\command">
<RegistryValue Type="string" Value="[VersionFolder]pwsh.exe -NoExit -RemoveWorkingDirectoryTrailingCharacter -WorkingDirectory &quot;%V!&quot; -Command &quot;$host.UI.RawUI.WindowTitle = '$(var.ProductName) $(var.SimpleProductVersion) ($(sys.BUILDARCH))'&quot;"/>
</RegistryKey>
<RemoveRegistryKey Id="RemoveOldOpenKey" Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\open" Action="removeOnInstall"/>
</Component>
and
<Component Id="PowerShellFileContextMenu">
<Condition>ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL</Condition>
<!-- When right-clicking ps1 file -->
<RegistryKey Root="HKCR" Key="Microsoft.PowerShellScript.1\Shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.PowerShellFileContextSubMenuDialogText)"/>
<RegistryValue Type="string" Name="Icon" Value="[VersionFolder]pwsh.exe" KeyPath="yes"/>
<RegistryKey Key="Command">
<RegistryValue Type="string" Value="[VersionFolder]pwsh.exe -Command &quot;$host.UI.RawUI.WindowTitle = '$(var.ProductName) $(var.SimpleProductVersion) ($(sys.BUILDARCH))'; &amp; '%1'&quot;"/>
</RegistryKey>
</RegistryKey>
</Component>

I only use the "Run With PowerShell" feature, so I don't know if this also applies to the "Open With PowerShell" feature, but you can at least re-add the "Run With..." entry with the following registry file (from Windows 10 and PowerShell 7x64):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\PowerShell7x64]
"Icon"="C:\\Program Files\\PowerShell\\7\\pwsh.exe"
"MUIVerb"="Run with PowerShell 7"

[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\PowerShell7x64\Command]
@="C:\\Program Files\\PowerShell\\7\\pwsh.exe -Command \"$host.UI.RawUI.WindowTitle = 'PowerShell 7 (x64)'; if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'\""

reduckted added a commit to reduckted/PowerShell that referenced this issue Oct 2, 2023
reduckted added a commit to reduckted/PowerShell that referenced this issue Oct 2, 2023
@ceztko
Copy link

ceztko commented Apr 24, 2024

It just happened to me with Windows Update silent installation of 7.4.2.

@kilasuit
Copy link
Collaborator

This shouldn't happen with 7.4.3 if #20420 can be merged soon

@reduckted
Copy link
Contributor

Just a small clarification on what to expect once that PR is merged. This problem will still exist for the first version that contains the fix. The installer for that version will remember the options you choose. The version after that will use those settings that were remembered.

@SteveL-MSFT SteveL-MSFT added KeepOpen The bot will ignore these and not auto-close WG-NeedsReview Needs a review by the labeled Working Group and removed WG-NeedsReview Needs a review by the labeled Working Group labels Apr 29, 2024
Copy link
Contributor

microsoft-github-policy-service bot commented May 7, 2024

📣 Hey @awsr, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

@microsoft-github-policy-service microsoft-github-policy-service bot removed the KeepOpen The bot will ignore these and not auto-close label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Maintainers-Build specific to affecting the build In-PR Indicates that a PR is out for the issue Issue-Enhancement the issue is more of a feature request than a bug
Projects
None yet