Google-chrome – Powershell to set Chrome as default browser

browsergoogle-chromepowershell

I been searching for a couple of day now to set this.

    Windows Registry Editor Version 5.00

    ; Set IE as default & associate CSS / HTM / HTML with Notepad Plus
    ; Made for Windows 7

 [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.mht\UserChoice]
"Progid"="IE.AssocFile.MHT"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.mhtml\UserChoice]
"Progid"="IE.AssocFile.MHT"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.url\UserChoice]
"Progid"="IE.AssocFile.URL"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice]
"Progid"="IE.HTTP"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice]
"Progid"="IE.HTTPS"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice]
"Progid"="IE.FTP"


;Associate CSS / HTM / HTML with Notepad Plus

[HKEY_CURRENT_USER\Software\Classes\.CSS]
@="Notepad++"

[HKEY_CURRENT_USER\Software\Classes\.HTM]
@="Notepad++"

[HKEY_CURRENT_USER\Software\Classes\.HTML]
@="Notepad++"

[HKEY_CURRENT_USER\Software\Classes\Notepad++\shell\open\command]
@="d:\\Tools\\NPP\\notepad++.exe \"%1\""

[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.css]

[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm]

[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html]
<code>

I have tried to do it through the registry. Failed

$Path = $env:TEMP; $Installer = "chrome_installer.exe"; Invoke-WebRequest 
"http://dl.google.com/chrome/install/3..." -OutFile $Path\$Installer; Start-Process -FilePath
$Path\$Installer -Args "/silent /install" -Verb RunAs -Wait; Remove-Item $Path\$Installer

$chromePath = "${Env:ProgramFiles(x86)}\Google\Chrome\Application\" 
$chromeApp = "chrome.exe"
$chromeCommandArgs = "--make-default-browser"
& "$chromePath$chromeApp" $chromeCommandArgs

I have tried the above script. Failed

I have also tried the –make-default-browser. Failed

I have tried to do this through GPO. Failed

how do I make windows 10 through Power shell to set the default browser to Google Chrome

The above other question give me this output
PowerShell Chrome error

Best Answer

Instead of trying to manipulate browser settings via the registry, consider using the OS to assign file types with executables. Normally I'd rather stay in PSH to do things... but I do know that you could associate file types to Chrome using CMD's assoc and ftype commands.

If there is a PSH way to do this, I don't know it. If someone reading this knows how in PSH, please comment. I'd be curious.

from PSH, call them like so:

cmd /c assoc
cmd /c ftype
  • Open an elevated command promote.
  • Use FTYPE {fileType}={commandString} to creat a file type and associated command to open the file.
  • Use ASSOC {.fileExtension}={fileType}

For example:

cmd /c assoc .txt=txtfile
cmd /c ftype txtfile=c:\Program Files\Windows NT\Accessories\wordpad.exe "%1"

For more information, please refer to:

Associate a File Type with a Specific Program

Source