I'm working on a SCCM Application Packager recipe to automate the download, packaging, and deployment of JetBrains Toolbox. I'm trying to use the Invoke-WebRequest cmdlet to assign the href value where the outer text is "direct link" to a variable called $LinkPath
$LinkPath = ((Invoke-WebRequest https://www.jetbrains.com/toolbox/download/download-thanks.html?platform=windows) | Select-Object -ExpandProperty Links | Where-Object -Property outerText -eq "direct link").href
This keeps returning the URL:
about://data.services.jetbrains.com/products/download?code=ALL&platform=windows
When I view the returned object I see the same URL:
innerHTML : direct link
innerText : direct link
outerHTML : <A id=download-link href="about://data.services.jetbrains.com/products/download?code=ALL&a
mp;platform=windows" data-release-download-link="">direct link</A>
outerText : direct link
tagName : A
id : download-link
href : about://data.services.jetbrains.com/products/download?code=ALL&platform=windows
data-release-download-link :
How can I assign either the URL of the installer that automatically downloads when you hit that page -or- the URL you get when you check the properties of the "direct link" link in a browser (currently https://download.jetbrains.com/toolbox/jetbrains-toolbox-1.14.5179.exe) to the $LinkPath vairable instead of about://data.services.jetbrains.com/products/download?code=ALL&platform=windows ?
I found a chocolatey project that does this in a slightly different fashion. It uses this the Json data here to determine the version:
https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release
I used ConvertFrom-Json to get the current download URL from the page above:
$releases = 'https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release'
$json = Invoke-WebRequest $releases | ConvertFrom-Json
$LinkPath = $json.TBA.downloads.windows.link