I wanted to: 1. In Windows, Determine the system's default browser 2. Pass the browser to a new-object definition 3. Open the browser and goto a url
This is what works so far:
Function GET-DefaultBrowserPath {
#Get the default Browser path
New-PSDrive -Name HKCR -PSProvider registry -Root Hkey_Classes_Root | Out-Null
$browserPath = ((Get-ItemProperty 'HKCR:\http\shel\open\command').'(default)').Split('"')[1]
return $browserPath
}
GET-DefaultBrowserPath
However, the only way I know how to open a browser and go to a url is:
$IE = new-object internetexplorer.application
$IE.navigate2("www.microsoft.com")
$IE.visible=$true
and this does not work:
$browser_object = new-object -com $browserPath.application
nor does this:
$browser_object = new-object -com firefox.application
Any help would be much appreciated.
Chris