Learning invoke-webrequest by creating something practical… Script to download all drivers (*.exe) from a dell support page. The script works with-out error. I had a hard time filtering out non exe files and still having a uri to download from. Just looking for feedback. Is there an easier way? How would you do it? I’m self-employed, so I have not access to peer review.
Thanks!!
$dell = ( (Invoke-WebRequest -Uri http://downloads.dell.com/published/pages/optiplex-740.html#drivers).links | where-Object {$_.href -like "*.exe"})
Foreach ($href in $dell.href){
$md = (Split-Path -Path $href)
New-Item -ItemType Directory -path "c:\users\frank\test\$md" -Force
iwr ("http://downloads.dell.com$href") -outfile "c:\users\frank\test\$href"
}
# Example of download path: http://downloads.dell.com/audio/SIGMATEL_STAC-92XX-C-Major-H_A06_R182475.exe