Adding Windows Explorer context menus do not work in 20H1

%3CLINGO-SUB%20id%3D%22lingo-sub-956017%22%20slang%3D%22en-US%22%3EAdding%20Windows%20Explorer%20context%20menus%20do%20not%20work%20in%2020H1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-956017%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20you%20add%20Windows%20Explorer%20context%20menus%20items%20via%20the%20registry%20they%20do%20not%20work%20in%2020H1.%3C%2FP%3E%3CP%3EThe%20example%20below%20would%20create%20a%20run%20as%20administrator%20for%20PowerShell%20ps1%20files%20in%20all%20previous%20versions%20of%20Windows%20up%20to%20and%20including%201909%2C%20but%20it%20does%20not%20work%20in%2020H1.%20This%20is%20not%20limited%20to%20ps1%20files.%20I%20cannot%20create%20a%20context%20menu%20for%20any%20of%20the%20file%20types%20I%20have%20tried.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5BHKEY_CLASSES_ROOT%5CMicrosoft.PowerShellScript.1%5CShell%5Crunas%5Ccommand%5D%3CBR%20%2F%3E%40%3D%22powershell.exe%20%5C%22-Command%5C%22%20%5C%22if((Get-ExecutionPolicy%20)%20-ne%20'AllSigned')%20%7B%20Set-ExecutionPolicy%20-Scope%20Process%20Bypass%20%7D%3B%20%26amp%3B%20'%251'%5C%22%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESimilarly%20if%20you%20try%20to%20create%20context%20sub%20menus%20using%26nbsp%3BExtendedSubCommandsKey%20these%20do%20not%20work%20either.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThey%20will%20however%20work%20for%20Directory%20and%20Drive%20keys%20-%20as%20in%20Open%20PowerShell%20Here%20or%20cmd%20here.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20anyone%20from%20Microsoft%20explain%3F%3C%2FP%3E%3CP%3EPete%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1042654%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20Windows%20Explorer%20context%20menus%20do%20not%20work%20in%2020H1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1042654%22%20slang%3D%22en-US%22%3E%3CP%3EI%20found%20what%20has%20happened%20here%20with%20specifically%20ps1%20files.%3C%2FP%3E%3CP%3EHKEY_CLASSES_ROOT%5CMicrosoft.PowerShellScript.1%20has%20been%20removed%20as%20a%20default%20handler%20for%20ps1%20files%20in%2020H1.%3C%2FP%3E%3CP%3EThe%20handler%20is%20now%20located%20at%26nbsp%3BHKEY_CLASSES_ROOT%5CSystemFileAssociations%5C.ps1%5CShell%5C0.%20Adding%20context%20items%20here%20works.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

If you add Windows Explorer context menus items via the registry they do not work in 20H1.

The example below would create a run as administrator for PowerShell ps1 files in all previous versions of Windows up to and including 1909, but it does not work in 20H1. This is not limited to ps1 files. I cannot create a context menu for any of the file types I have tried.

 

[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\runas\command]
@="powershell.exe \"-Command\" \"if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'\""

 

Similarly if you try to create context sub menus using ExtendedSubCommandsKey these do not work either.

 

They will however work for Directory and Drive keys - as in Open PowerShell Here or cmd here.

 

Can anyone from Microsoft explain?

Pete

1 Reply
Highlighted

I found what has happened here with specifically ps1 files.

HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1 has been removed as a default handler for ps1 files in 20H1.

The handler is now located at HKEY_CLASSES_ROOT\SystemFileAssociations\.ps1\Shell\0. Adding context items here works.