I'm trying to create a script which will parse an URL for a specific exe download link and download it. I'm doing this because the download link changes frequently. Below the code:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$path = "https://www.broadcom.com/support/security-center/definitions/download/detail?gid=sep14"
$definitionPath = (Invoke-WebRequest $path).Links |
Where-Object{$_.InnerText -like "*core15sdsv5i64.exe" -and $_.InnerText -notlike "*.jdb"} |
Select-Object -ExpandProperty href
$Output = "C:\temp\virus_definition.exe"
$start_time = Get-Date
Invoke-WebRequest -Uri $definitionPath -OutFile $Output
I receive one error telling me that the argument "$definitionPath" is empty or null. Any ideas how can i fix that?
Thanks.