Script powershell ouverture de multiple URL depuis un excel

solosikoa 0 Reputation points

Bonjour tous le monde,

Est t'il possible de faire un script PowerShell qui ouvre différent URL puis les ferme depuis un fichier Excel ?

A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
1,550 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 43,231 Reputation points
    Hello there,
    Suppose you have a text file "url.txt" located in c:\temp and that each line in the file corresponds to a url you want to open with IE. Then the code below would open each url in the file.
    $textfile = "c:\temp\url.txt"
    ForEach ($url in Get-Content $textfile) {
        $IE=new-object -com internetexplorer.application
    Hope this resolves your Query !!
    --If the reply is helpful, please Upvote and Accept it as an answer--

  2. Rich Matheisen 42,906 Reputation points

    If you're working with Excel spreadsheets you should install the ImportExcel module. It makes coding much simpler.

    You haven't stated what information you need from the target URL so the code below just saves the web page(s) in an array.

    Here's an example that does what you asked:

    [array]$x = @()
    Import-Excel C:\junk\urls.xlsx |
            $x += Invoke-WebRequest $_.URL -UseBasicParsing

    Here's a sample spreadsheet:

    User's image

    0 comments No comments