PoshCode Archive  Artifact Content

Artifact 57963f3a550249d8aa8803451a614ac4fa8e4ac79e2b92dfebb5d6218ca95f6a:

  • File Set-defaultBrowser.ps1 — part of check-in [388cd2cdc9] at 2018-06-10 13:26:44 on branch trunk — With this function I can switch between IE and Firefox as default browser. It is just a start. There might be some more registry keys to be changed (user: Bernd Kriszio size: 1983)

# encoding: ascii
# api: powershell
# title: Set-defaultBrowser
# description: With this function I can switch between IE and Firefox as default browser. It is just a start. There might be some more registry keys to be changed
# version: 0.1
# type: function
# author: Bernd Kriszio
# license: CC0
# function: Set-defaultBrowser
# x-poshcode-id: 3504
# x-archived: 2017-05-19T16:43:20
# x-published: 2013-07-07T08:26:00
#
#
function Set-defaultBrowser
{
    param($defaultBrowser)

    switch ($defaultBrowser)
    {
        'IE' {
            Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice' -name ProgId IE.FTP
            Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice' -name ProgId IE.HTTP
            Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice' -name ProgId IE.HTTPS
            
        }
        'FF' {
            Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice' -name ProgId FirefoxURL
            Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice' -name ProgId FirefoxURL
            Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice' -name ProgId FirefoxURL
        }
    } 
    
# thanks to http://newoldthing.wordpress.com/2007/03/23/how-does-your-browsers-know-that-its-not-the-default-browser/
        
<#
(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice').ProgId
(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice').ProgId
(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice').ProgId
#>

}

# Set-defaultBrowser ff
# Set-defaultBrowser ie