tags:

views:

69

answers:

1

This, when run from the PowerShell console, launches Internet Explorer, just as expected:

$ie_command = "C:\Program Files (x86)\Internet Explorer\iexplore.exe"
&$ie_command

If I put the same exact code inside a function within a module, it does nothing. And, yes, other code within the same function works properly, so it's not an issue of the module not being imported or anything.

Am I missing something? Why wouldn't this work?

+1  A: 
PS C:\SchedTasks\test> cat test.ps1
$ie_command = "C:\Program Files\Internet Explorer\iexplore.exe"
&$ie_command
PS C:\SchedTasks\test> .\test.ps1
PS C:\SchedTasks\test>

This brings up a browser window for me. Are you doing anything different than this?

In any case, another way to start Internet Explorer is by using a COM adapter:

$ie = new-object -com InternetExplorer.Application
$ie.Visible = $True
Michael Steele