1

Heart of the problem: I'm trying to download a 650mb file using VBScript. Any file over 500mb fails with the following error...

Error: Not enough storage is available to complete this operation Code: 8007000E

Source: msxml3.dll <-- When using MSXML.XMLHTTP or...

Source: WinHttp.WinHttpRequest <-- when using WinHTTP

I'm using the code from here, both MSXML.XMLHTTP and WinHTTP (not wget). Both scripts I can watch in Task Manager build up to just over 650mb, and then fail with the above error. The scripts work, if I choose smaller files the download occurs just fine.

The lines referenced in the error messages is .Write objHTTP.responseBody for both.

I've found a few other people having this same problem, although there doesn't seem to be a large amount of people trying to download giant files with vbscript... I can't imagine why.

I know it's not a space issue (I have plenty of hard drive space), or a memory issue (I have 4gb, physical memory shows about 70% at peak). I've also tried setting the SetTimeouts option as detailed here when using WinHTTP (I even set them all to -1, infinite timeout), and tried using MSXML.ServerXMLHTTP which allows SetTimeouts as well, both a no-go

Background: I'm trying to write a vbscript to automatically download and install a set of software for a large number of users. Because it's going to be distributed to so many people I would like to do it natively in Windows, since I don't know exactly what other software they may or may not have. This limits my options quite a bit. Powershell policy is set to restricted, so I can't use that on others computers, not without detailing how to reset it for them which defeats the purpose of a script that's supposed to do everything for non-techie users. This pretty much leaves vbscript.

If there is no other way to do this, then my next step is probably going to be to automate the downloading and installation of a smaller file, like wget, and then use that to download the larger one. Again though, I'd like to do this with minimum, native software. It seems like this is something that should be possible, but I can't find a solution.

edit: I can't post more than 2 links as a new user, so you're just going to have to take my word that I've found other people having this issue, but no answers to their threads (here or anywhere else).

2 Answers 2

2

I cannot reproduce your problem, so I'm unable to provide a solution. However, you may be able to work around it by downloading the file in chunks instead of as a whole:

chunksize = 524288000  '500 MB
url = "..."

Set stream = CreateObject("ADODB.Stream")
stream.Open
stream.Type = 1 'binary

i = 0
Do
  first = i * chunksize
  last  = first + chunksize - 1

  Set req = CreateObject("Msxml2.XMLHttp.6.0")
  req.open "GET", url, False
  req.setRequestHeader "Range", "bytes=" & first & "-" & last
  req.send

  If req.Status = 206 Then stream.Write req.responseBody

  i = i + 1
Loop Until CLng(req.getResponseHeader("Content-Length")) <> chunksize

stream.SaveToFile "C:\path\to\output.file", 2
stream.Close
1
  • Sorry, I've had to focus my time on another project for now and haven't had time to try this. This does look like exactly the solution I was looking for though so I'm accepting this answer. When I get more time I'll try to remember to come back and give more feedback. Thanks! Sep 3, 2013 at 13:10
0

Here I see you have uses HTTP which doesnot support ftp. So my suggestion would be to use Wget. http://www.codeproject.com/Tips/506439/Downloading-files-with-VBScript

1
  • The files I'm downloading are on HTTP servers, not FTP. Yes, wget could do both, and as I noted I could use that as a last option, but that would require another download and install on the end users computer once the script is distributed since it isn't natively included in Windows (unless I missed something). That page you linked is the same on I linked in my second paragraph, I'm using the 2nd and 3rd script on that site. Both of these work fine for 2/3rds of the files I need (the smaller ones), but fail on the 3rd, larger file. Aug 27, 2013 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.