PowerShell – Get Default Browser from Remote PC


Did you ever need to know what the Default Browser of a remote computer was? I did. Today I´m going to show you how you can do this using PowerShell and the Microsoft Windows Registry. Here is the Script:


Param([parameter(Mandatory=$true)][alias("Computer")]$ComputerName)

$Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName)
$RegistryKey = $Registry.OpenSubKey("SOFTWARE\\Classes\\http\\shell\\open\\command")
#Get (Default) Value
$Value = $RegistryKey.GetValue("")

$Value

The above Script will return a String like:

C:\Program Files\Internet Explorer\iexplore.exe" %1

As you can see the Default Browser of my computer is Internet Explorer.

Here the above Script packaged as a function ready to use:

function Get-DefaultBrowser
{
Param([parameter(Mandatory=$true)][alias("Computer")]$ComputerName)

$Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName)
$RegistryKey = $Registry.OpenSubKey("SOFTWARE\\Classes\\http\\shell\\open\\command")
#Get (Default) Value
$Value = $RegistryKey.GetValue("")

return $Value
}

As always you can download my Script here.

Sources:

http://www.ehow.com/how_6325458_configure-browser-using-regedit-xp.html

http://msdn.microsoft.com/en-us/library/ctb3kd86(v=vs.110).aspx

http://serverfault.com/questions/270053/how-to-set-firefox-as-default-browser-using-a-script

http://www.culham.net/2013/powershell/remotely-accessing-the-registry-using-windows-powershell

Advertisements
Tagged

One thought on “PowerShell – Get Default Browser from Remote PC

  1. I’ll immediately clutch your rss as I can’t find your
    e-mail subscription hyperlink or e-newsletter service.
    Do you have any? Kindly allow me understand so that I could subscribe.
    Thanks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: