Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 31st, 2012  |  syntax: None  |  size: 0.70 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do I create an object based on the output of a Function in Power Shell?
  2. Function GET-DefaultBrowserPath {
  3.         #Get the default Browser path
  4.         New-PSDrive -Name HKCR -PSProvider registry -Root Hkey_Classes_Root | Out-Null
  5.         $browserPath = ((Get-ItemProperty 'HKCR:httpshelopencommand').'(default)').Split('"')[1]
  6.         return $browserPath
  7.     }
  8.  
  9. GET-DefaultBrowserPath
  10.        
  11. $IE = new-object internetexplorer.application
  12. $IE.navigate2("www.microsoft.com")
  13. $IE.visible=$true
  14.        
  15. $browser_object = new-object -com $browserPath.application
  16.        
  17. $browser_object = new-object -com firefox.application
  18.        
  19. Start-Process $url
  20.        
  21. $path = GET-DefaultBrowserPath
  22. $url = "www.microsoft.com"
  23. &$path $url