How to automate setting Chrome as default browser in Windows 10
I've tried setting default in the reg keys:
hkeycu>software>microsoft>windows>shell>associations>urlassociations>http
and https
.
Tried using master_preference
file.
Tried using command switch --make-default-browser
.
So far these aren't working.
Any help would be appreciated. Open to any to batch files, registry keys, file replacements/edits... basically anything I can automate.
Solution 1:
Have you tried making a .vbs file to set Chrome as the default browser automatically?
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=google%20chrome"
WScript.Sleep 1200
WshShell.SendKeys "{TAB}"
WshShell.SendKeys " "
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys " "
WScript.Quit
Reference: comment by user "Raz" in Making IE the default browser in Windows 10 during OSD
Solution 2:
To change default browser in Windows 10 try the tool from Christoph Kolbicz - https://kolbi.cz/blog/2017/11/10/setdefaultbrowser-set-the-default-browser-per-user-on-windows-10-and-server-2016-build-1607/.
Launched SetDefaultBrowser.exe HKLM "Google Chrome"
and it worked fine for me.
Solution 3:
Here is the PowerShell version of the Judy Li / Raz solution:
function Set-ChromeAsDefaultBrowser {
Add-Type -AssemblyName 'System.Windows.Forms'
Start-Process $env:windir\system32\control.exe -ArgumentList '/name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=google%20chrome'
Sleep 2
[System.Windows.Forms.SendKeys]::SendWait("{TAB} {TAB}{TAB} ")
}
Solution 4:
The answer from Judy Li still worked for me on 2021-01-04 with the latest windows 10 built. However, I had to update the the number of tab's and sleep commands.
The updated steps are:
- Create a VBS files with the code below
- Open folder
shell:startup
with [win]+[r] or file explorer - Store the file in the startup folder to execute the script with each restart
VBS Code
Set WshShell = WScript.CreateObject("WScript.Shell")
' Open the default settings window
WshShell.Run "%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=google%20chrome"
WScript.Sleep 5000 ' Wait until open (adjust if necessary)
' Adjust number of tabs until you reach the browser choice setting
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
' Open the browser choice menu
WshShell.SendKeys " "
WScript.Sleep 500 ' Wait until open
WshShell.SendKeys "{TAB}" ' Move down one selection
WshShell.SendKeys " " ' Set current selection as default browser
WScript.Sleep 500 ' Wait until open
' Uncomment the line below to outomatically close the settings window
' WshShell.SendKeys "%{F4}"
WScript.Quit