Home > Software design >  Set Microsoft Edge as default browser with PowerShelll
Set Microsoft Edge as default browser with PowerShelll

Time:10-01

I'm doing a script that change the default browser to the Microsoft Edge and I have done this:

  function Set-DefaultBrowser {
Add-Type -AssemblyName 'System.Windows.Forms'
Start-Process $env:windir\system32\control.exe -LoadUserProfile -Wait -ArgumentList '/name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=MSEdgeHTM'
Sleep 10
[System.Windows.Forms.SendKeys]::SendWait("{TAB}{TAB}{TAB}{TAB}{TAB} {ENTER}{ENTER} ")
}
Set-DefaultBrowser

But i don't like that is like a person where doing it opening the menu and that stuff I would like to do it like without showing it like that, it is posible to do it that way?

CodePudding user response:

My recommendation is to set the Regkeys that control default browser. Here is a link to a post showing how to do it with Chrome

https://itectec.com/superuser/cmd-command-to-set-chrome-as-default-browser-windows-10/

You'll notice the command needed but change the app name to that of Edge

Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice' -Name ProgId -Value 'ChromeHTML' Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice' -Name ProgId -Value 'ChromeHTML'

  • Related