Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Downloading from temporary link with Powershell

  • Please log in to reply
1 reply to this topic

#1 mysticduck


  • Members
  • 35 posts
  • Gender:Male
  • Location:Southern Oregon
  • Local time:06:20 AM

Posted 06 April 2015 - 02:12 PM

Howdy.  I have a Powershell script I use to download some files daily.

$client = new-object system.Net.Webclient
$source = "http://media.kaspersky.com/utilities/VirusUtilities/EN/tdsskiller.exe"
$dest = "\\syn\software\tools\tdsskiller.exe"
Invoke-WebRequest $source -OutFile $dest

I had to use the two different methods at some point to fix some download problem.  Anywho, I want to be able to download adwcleaner daily but I can't find a static link for it.  The link from here at Bleeping changes frequently and the one at toolslib doesn't work in the script, it doesn't point to an exe.  Any ideas out there?    

Stultorum infinitus est numerus

BC AdBot (Login to Remove)


#2 JohnnyJammer


  • Members
  • 1,117 posts
  • Gender:Male
  • Location:QLD Australia
  • Local time:11:20 PM

Posted 08 April 2015 - 07:05 PM

Im pretty sure that system.net.WebClient doesnt support a HEAD request to see if the file exists before performing the Downloadfile command.

the next thing i would do is use the HttpWebRequest instead to see fi it exists first and if true then use the $client.Downloadfile.

remember with powershell you can utilise the .net framework mate.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users