lextm/windowsterminal-shell

Registry bug

Lucane opened this issue · 6 comments

I have an issue with the script that I can't seem to figure out. The short version of it is that the script successfully creates the necessary registry keys, but no shell entries are created and the keys don't show up in the Registry Editor.

I checked that the keys aren't created under Wow6432node (as they would if they were created in a 32-bit application) and that Powershell is running in 64-bit (which it is):

PS C:\Users\Avalerion\Desktop> [Environment]::Is64BitProcess
True

The interesting thing is that when I use the following command, PowerShell retrieves the correct value:

PS C:\> Get-ItemProperty -Path "HKCU:\SOFTWARE\Classes\Directory\shell\MenuTerminal" | Select-Object -ExpandProperty MUIVerb
Windows Terminal here

And yet, they key doesn't show up in the Registry Editor:
Screenshot 2020-10-08 040014

I also used the Registry Editor's search function to search for the keys, but didn't find a match.
Anybody have an idea what might be going on here?

lextm commented

You can monitor registry keys via tools like Process Monitor, so debugging further and the cause should reveal itself.

I used ProcMon and everything seemed to match up. I also enabled registry auditing and everything showed as expected.
What I found, is that I could create and remove keys with Powershell 5 and they show up in the registry just fine.

It turns out, the MS Store release of Powershell 7 was the culprit. I have no clue why that would be the case, but when I downloaded the release from GitHub and installed that, everything worked just fine.

This is so bizarre, but I guess my issue is solved now. I installed it from the Store out of pure laziness, but clearly that was a mistake 😄

lextm commented

@Lucane What is "MS Store release of PowerShell 7"? Do you refer to this?

Yeah, that's the one. As far as I could tell, it should include the latest release available on GitHub.

lextm commented

Not quite familiar with the Store app model, but based on several sources such apps do not have full access to Windows registry (but a virtual one), so any changes made by them do not apply to your Windows installation machine-wide. That can be the cause.

https://stackoverflow.com/questions/34694059/read-write-registery-key-file-in-uwp

That would certainly explain the symptoms I was having. It does seem peculiar as to why Microsoft would publish it on the Store if it suffers from these issues.