Answered by:
How to open URL through powershell

Question
-
How to open URL through powershell ?
Tuesday, April 27, 2010 7:35 AM
Answers
-
Hi,
We can use the following method to open URL:
$IE=new-object -com internetexplorer.application
$IE.navigate2("www.microsoft.com")
$IE.visible=$trueFor your reference:
Controlling Internet Explorer object from PowerShell
http://blogs.msdn.com/powershell/archive/2006/09/10/controlling-internet-explorer-object-from-powershell.aspxThanks.
This posting is provided "AS IS" with no warranties, and confers no rights.- Marked as answer by Mervyn Zhang Thursday, April 29, 2010 8:39 AM
Wednesday, April 28, 2010 10:49 AM -
start https://microsoft.com
- Proposed as answer by Misinformed DNA Friday, April 13, 2018 3:05 PM
- Marked as answer by jrv Saturday, November 9, 2019 3:28 AM
Monday, July 24, 2017 11:37 AM
All replies
-
Many ways to do that
Start-Process -Path "http://www.microsoft.com/"
[
System.Diagnostics.Process]::Start("http://www.microsoft.com/")
(
New-Object<span style="font-family: Courier New; font-size: x-small;%
Ravikanth
http://www.ravichaganti.com/blog
Twitter: @ravikanth
PowerShell 2.0 remoting - eBook- Proposed as answer by Marco Shaw Tuesday, April 27, 2010 11:26 AM
Tuesday, April 27, 2010 8:53 AM -
many ways to do that
Start-Process -Path "url"
[System.Diagnostics.Process]::Start("url")
(New-Object -Com Shell.Application).Open("url")
Ravikanth
http://www.ravichaganti.com/blog
Twitter: @ravikanth
PowerShell 2.0 remoting - eBook- Proposed as answer by Ravikanth.ChagantiMVP Tuesday, April 27, 2010 10:33 AM
- Unproposed as answer by Marco Shaw Tuesday, April 27, 2010 11:27 AM
- Proposed as answer by asdf4_44 Tuesday, February 9, 2016 6:26 PM
Tuesday, April 27, 2010 8:53 AM -
Pls find the output
[PS] D:\>Start-Process -Path "http://www.microsoft.com/"
Start-Process : A parameter cannot be found that matches parameter name 'Path'.
At line:1 char:20
+ Start-Process -Path <<<< "http://www.microsoft.com/"
+ CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand[PS] D:\>
Tuesday, April 27, 2010 10:14 AM -
My bad. Start-Process -FilePath "url". In fact, you don't need -FilePath to open link in the browser
HTH
Ravikanth
http://www.ravichaganti.com/blog
Twitter: @ravikanth
PowerShell 2.0 remoting - eBook- Proposed as answer by Ravikanth.ChagantiMVP Tuesday, April 27, 2010 10:33 AM
Tuesday, April 27, 2010 10:33 AM -
Hi,
We can use the following method to open URL:
$IE=new-object -com internetexplorer.application
$IE.navigate2("www.microsoft.com")
$IE.visible=$trueFor your reference:
Controlling Internet Explorer object from PowerShell
http://blogs.msdn.com/powershell/archive/2006/09/10/controlling-internet-explorer-object-from-powershell.aspxThanks.
This posting is provided "AS IS" with no warranties, and confers no rights.- Marked as answer by Mervyn Zhang Thursday, April 29, 2010 8:39 AM
Wednesday, April 28, 2010 10:49 AM -
[System.Diagnostics.Process]::Start("chrome.exe","http://www.julesbartow.com")Tuesday, June 4, 2013 6:10 PM
-
My first portion for chrome works fine & i have also added the following:
get-process | where {$_.mainwindowtitle -match "chrome"} | format-table id, name, mainwindowtitle -autosize
but the webpage that is loaded has content
You have logged in as
"Road Traffic In-Charge"
Do you want to change the role?and if i need to get the text "Road Traffic In-Charge" - then on the page - if i right-click - i get to use "Inspect"
--- which shows:::
<div class="logincontinuemessage popup-main-content-div popup-main-content-div-continue">
<span>You have logged in as</span><br>
<span id="user-role">"Road Traffic In-Charge"</span>
<br>
<span>Do you want to change the role?</span>
</div>If i were using IE - then can i can do $ie = new-object -Comobject internetexplorer.application
which cannot be done for chrome??. So how do i get:
- document.content
- document text or innerText
- innerHTML
- fields & values.
Thanks
Ram.S
Tuesday, December 13, 2016 8:20 PM -
I needed a rotator and instead of using some javascript i created a powershell one based on the code above.
i thought i post it so someone might benefit as well.
$Rotator=new-object -com internetexplorer.application $Rotator.visible=$true $Sleeptimer = 30 $arrURL = @("www.microsoft.com","www.redhat.com","www.suse.com") $ii=0 While ($ii -ne ($arrURL.count +1)) { $Rotator.navigate2($arrURL[$ii]) $ii += 1 if ($ii -eq $arrURL.count){ $ii = 0 } Start-Sleep $Sleeptimer }
Rob Korving
http://jama00.wordpress.com/- Edited by rob1974 Monday, June 26, 2017 9:45 AM
Monday, June 26, 2017 9:44 AM -
start https://microsoft.com
- Proposed as answer by Misinformed DNA Friday, April 13, 2018 3:05 PM
- Marked as answer by jrv Saturday, November 9, 2019 3:28 AM
Monday, July 24, 2017 11:37 AM -
Best & Easiest!!Saturday, November 9, 2019 2:01 AM