Update Bing Search Toggle in tweaks.json#4161
Update Bing Search Toggle in tweaks.json#4161cpb34 wants to merge 2 commits intoChrisTitusTech:mainfrom
Conversation
Added an UndoScript in WPFToggleBingSearch that removes the DWORD CortanaConsent if it exists in HKCU:\Software\Microsoft\Windows\CurrentVersion\Search. When CortanaConsent is set to 1 in Windows 11, Bing Search may be enabled even when the DWORD BingSearchEnabled is set to 0. CortanaConsent only exists when a Windows 10 PC consented to Cortana and later migrated to Windows 11; a fresh Windows 11 installation does not include CortanaConsent and the script otherwise works in Windows 10 even with CortanaConsent set to 1.
Added an UndoScript in WPFToggleBingSearch that removes the DWORD CortanaConsent if it exists in HKCU:\Software\Microsoft\Windows\CurrentVersion\Search. When CortanaConsent is set to 1 in Windows 11, Bing Search may be enabled even when the DWORD BingSearchEnabled is set to 0. CortanaConsent only exists when a Windows 10 PC consented to Cortana and later migrated to Windows 11; a fresh Windows 11 installation does not include CortanaConsent and the script otherwise works in Windows 10 even with CortanaConsent set to 1.
|
Apologies, I just read issue #4155 after I submitted the pull request. I used a script since the end result removes the edge case while retaining what the registry structure should be; the standardized fix adds a DWORD that nearly every PC is perfectly fine without. If I had noticed the request for standardization, I would have submitted the following code. This adds CortanaConsent if it doesn't exist and sets it as 0 or 1 depending on the toggle state. It has been tested the same as the code submitted in the pull request. |
|
You dont need to update the Also the undo script wont run if there is no InvokeScript,And there is no reason to use a if statment there because winutil wont report an error anyway |
Not true; the UndoScript is firing when toggled off and it is not fired when toggled on. Those screenshots are the results of the exact changes submitted. About the errors, there was an error thrown in the CTT Powershell window while testing a different method regarding CortanaConsent not existing. Either way, not executing after an if statement is false is better in my opinion than silently failing. If you like the silent fail route more, the following script can be adapted for the winutil. Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "CortanaConsent" -ErrorAction SilentlyContinue Thanks for letting me know about BingSearch.md automatically updating. Later today if this PR isn't closed, I'll come back and submit a new standardized fix with test screenshots. |
okay but why add remove CortanaConsent when doing a undo? |
|
If I understood correctly, currently the tweak has an edge case when upgraded from Win10 to 11, which is:
So, setting the Invoke is not needed. Undo simply can remove it, and when user re-enables Bing search, it will work as it would on clean install. Did I get it right? |
oh i just remebered this is a toggle so the undo makes sense lol and yes this pr make sense |
All of that is correct other than the fourth bullet. It's while If the target behavior is that of a clean install, the PR achieves that. If it's more important for the code to be standardized, adding Thanks for verifying! It's a pretty common issue to see in the repair shop I work at; I just had to manually modify the Registry for a PC that came in 5 minutes ago too 😅 Also, thanks Chris for updating the offline EXE wrapper! It's awesome to see and I'll make sure to toss a few dollars toward the project when I get around to it. |
Type of Change
Description
Added an UndoScript in WPFToggleBingSearch that removes the DWORD CortanaConsent if it exists in HKCU:\Software\Microsoft\Windows\CurrentVersion\Search.
When CortanaConsent is set to 1 in Windows 11, Bing Search may be enabled even when the DWORD BingSearchEnabled is set to 0. CortanaConsent only exists when a Windows 10 PC consented to Cortana and later migrated to Windows 11; a fresh Windows 11 installation does not include CortanaConsent and the script otherwise works in Windows 10 even with CortanaConsent set to 1.
The images below were taken after refreshing Windows Explorer and the Registry Editor.
Without CortanaConsent removal (live internet build)


With CortanaConsent removal (local compiled build)