Last active
October 19, 2024 08:53
-
-
Save SCP002/a1700041a969b4eb6af58248c6853222 to your computer and use it in GitHub Desktop.
Windows Registry: Run .ps1 scripts with double click using pwsh (PowerShell 7). Including tweaks of context menu. See coments for description.
Forsure I know you can modify the Run with PowerShell (name) if you modify the Muicache Computer\HKEY_CLASSES_ROOT\Local Settings\MuiCache, but there is no way to outright prevent it. Currently the .exe in MUICache is @"C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe ",-108. Please let me know if you figure out an alternative for removing it. ):
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are correct, just checked it and on Windows 10 Pro 21H2, build 19044.2006.
Menu 'Run with PowerShell' does not disappear anymore after you delete the
HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\0
registry folder.But it worked on Windows 10 Pro 20H2, build 19042.928 from what I remember.
No clue so far on how to get rid of 'Run with PowerShell' now 😞
And about 'Run as administrator': It's the option this .reg file tries to add, not remove.
This one works fine for me.
But if you want to remove 'Run as administrator' from the list of context menu options, remove the
HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\RunAs
folder in registry editor.Or just add
[-HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\RunAs]
to this .reg file.