I want to set the old context menu for all new user in Windows 11. The solution for the current user is to set the following reg-key:
HKCU:SoftwareClassesCLSID{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}InprocServer32
Then the explorer has to restart.
With this reg-file I place a powershell command in the RunOnce section:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRunOnce]
"OldContextMenu"="powershell -Command "$regpath="HKCU:\SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" ; if(-not (Test-Path $regpath)){New-Item -Path $regpath -Force} ; Set-Item -Path $regpath -Value "" ; $null=Read-Host ; Stop-Process -Processname Explorer -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -force""
The resulting PowerShell commands run well in a PowerShell window with or without admin rights:
$regpath="HKCU:SOFTWAREClassesCLSID{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}InprocServer32" ; if(-not (Test-Path $regpath)){New-Item -Path $regpath -Force} ; Set-Item -Path $regpath -Value "" ; $null=Read-Host ; Stop-Process -Processname Explorer -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -force
Howto get this work in the RunOnce section?
I see the PowerShell window open at the beginning of the logon, but the code is not successful.
Tried to place an input line in the code for debugging purposes.
Michael.H is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.