download a file

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Shane Lindberg Shane Lindberg 6 months, 4 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #35895
    Profile photo of Shane Lindberg
    Shane Lindberg
    Participant

    When I either use invoke-webrequest or use .net System.Net.WebClient to download a file from dropbox it is smaller and corrupted

    $url = "https://www.dropbox.com/s/qzmw5mfuq56ckd5/smartctl.exe?dl=0"
    $output = "C:\users\owner\Desktop\cool.exe"
    $wn = New-Object System.Net.WebClient
    $wn.DownloadFile($url,$output)
    

    or

    $url = "https://www.dropbox.com/s/qzmw5mfuq56ckd5/smartctl.exe?dl=0"
    $output = "C:\users\owner\Desktop\cool.exe"
    Invoke-WebRequest -Uri $url -OutFile $output
    
    #35897
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Try changing that URL to "dl=1". It's a dropbox thing. 🙂

    #35899
    Profile photo of Shane Lindberg
    Shane Lindberg
    Participant

    Thanks Dave!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.