Download links with Parsed info RRS feed

  • Question

  • Good evening,

    For a class assignment, we are required to be able to download a link that will change over time as the software is updated. So this means we cannot hardcode the link into the PowerShell script. So far I am able to parse the link using  tags and can extract the 32-bit and 64-bit versions.

    I have this as my current work in progress, my professor showed an example using substrings and using an older method and not really using PowerShell tools. 

    Write-Host -ForegroundColor Yellow "Downloading Notepad ++ on Local Computer" 

    $notepadplusplus = ""
    $url = (Invoke-WebRequest -Uri $notepadplusplus -UseBasicParsing).links | select href | where {$_ -like "*7.*"} | where {$_ -like "*Installer.x64*"}  

    $output = "C:\Temp\notepad++.exe"

    Invoke-WebRequest -uri $url -OutFile $output

    • Edited by SirCruxr Wednesday, October 3, 2018 2:32 AM
    • Moved by Bill_Stewart Monday, December 17, 2018 6:35 PM This is not "scripts on demand"
    Wednesday, October 3, 2018 1:54 AM

All replies

  • Please fix our post. It is mostly unreadable due to html tags included.  You cannot have Grammerly enabled for this site.  COntact Grammerly for a fix for this issue.


    Wednesday, October 3, 2018 2:00 AM
  • I did not notice that, I have now corrected the issue. 
    Wednesday, October 3, 2018 2:35 AM
  • Thank you for fixing the post.

    Your code will download the file.  What I your question? What PowerShell tools are you referring to? 

    Note that is easier an faster to download a file with the webclient.

    $wc = New-Object System.Net.WebCLient


    Wednesday, October 3, 2018 2:44 AM
  • Actually as of the codes current state, it is printing the parsed data for the link for the x64 installer. I need to be able to select the parsed data(which is the most current installer) and download the software to install. The code needs to be flexible as the software updates. 
    Wednesday, October 3, 2018 3:04 AM
  • Unfortunately that is not a question and it is very vague.

    What is it that you are having an issue with.  You have the link to the latest version just download it.

    This line:

    $notepadplusplus = ""

    Should be this:

    $notepadplusplus = ''

    which always points to the latest version.  Now extract the installer link from that page and you will always have the latest.


    Wednesday, October 3, 2018 3:09 AM