Simplifying Default Browser Changes in Windows 11 with PowerShell

Changing the default browser in Windows 10 and Windows 11 has become more complex than altering registry values due to enhanced security measures, particularly since Windows 10 introduced hash protection.

While one option involves utilizing group policy settings, this can prove cumbersome, especially in non-managed environments like certain cloud setups.

However, there exists a straightforward solution: leveraging PowerShell's ability to simulate user interactions, such as keystrokes. Commands like $shell.SendKeys('{TAB}') or $shell.SendKeys("edge") enable us to automate the process of navigating Windows settings and changing the default browser.

The script supports the three most common browser options: Microsoft Edge, Mozilla Firefox, and Google Chrome. It's crucial to have the desired browser already installed on your system. Furthermore, the script can be customized to include additional browser options.

For instance, to incorporate Brave as a selectable browser, ensure it's installed and include the following lines:


# Set Brave as the default browser $shell.SendKeys("brave"); Start-Sleep -seconds 1

There are two execution options:

Option #1: Running a Simple Script In this method, simply execute the script to change the default browser. It can be implemented as a logon script or in any preferred manner.

By default, the script sets the default browser to Edge:

 

Default browser set to Edge




To modify the default browser, uncomment the desired browser and comment out the current selection.

For example, to switch from Microsoft Edge to Mozilla Firefox:

 

Changing default browser to Firefox

Download the script: Set-default-browser-W11.ps1



Option #2: Running the Script as a Function This method offers easier editing. Simply adjust the last line of the script to specify the desired browser and execute it.

To set the default browser to Firefox from Edge:

 

Setting default browser to Firefox

To revert back to Edge:

 

Setting default browser back to Edge




Download the script: set-default-browser-W11-function.ps1

Hope this simplifies the process for you!

Post a Comment

Previous Post Next Post