Invoke-WebRequest Feedback

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.

 $dell = ( (Invoke-WebRequest -Uri | 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 ("$href") -outfile "c:\users\frank\test\$href" 
# Example of download path:

I don’t know Frank, looks like a pretty clean piece of code to me. As long as it works, I can’t, off hand, think of a better way to do it.

I concur with Curtis. Your code looks pretty compact for what you want to achieve. I’d add some additional error handling (try/catch) and maybe nice verbose/error messages for the consumers of the script/function.

Thank you… Thought it seem OK. I have little interaction with other techs period and none that have any desired to use/learn power shell. I greatly appreciate the feedback. I will turn the script into a function, add a little write-verbose, and see if I can make it find the download page by model name. Seem like it would be handy for someone with multiple Dell computers, so I post the final function encase others have a use.