CodeMonkey
CodeMonkey

Reputation: 1156

Extract ISO using vbscript

Today's problem is this:

I need to extract an ISO image file for windows updates using VBScript. Reason for using VBScript is because everything in on stand-alone systems, and I'm trying to automate the process by making scripts.

That ISO file will be on a CD/DVD, via D:

If it is possible and anyone can help me, that would be awesome!

Although, if it is not possible, could it be done using standard windows command line, using a batch file?

Upvotes: 0

Views: 2484

Answers (3)

Mix Van
Mix Van

Reputation: 1

I only know you can use the iso tool to extract this kind of files. Like Poweriso, magiciso and WinISO. And hope the tool will help you.

Upvotes: 0

rojo
rojo

Reputation: 24466

If your server is running Windows Server 2012 or Windows 8 and has PowerShell installed, you can use PowerShell to mount your ISO image as a drive, do what you need with the contents, then dismount. To automate the mounting without requiring user input, you'll find the command-line switches for Mount-DiskImage in Microsoft's Mount-DiskImage TechNet Article.

I'm not sure which version of PowerShell began including the Mount-DiskImage cmdlet. It doesn't appear to be available on my Win 7 computer, which has PowerShell v2.0 installed.

Upvotes: 1

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200273

VBScript provides no function for extracting ISO images. And as @rojo already said in his comment: why would you burn an ISO image on a CD as a file in the first place? You don't gain anything by doing this. More appropriate procedures are:

  • Create a CD from the image (if you need just the files from that image). That way you can simply access the files on drive D: with your script.
  • Extract the files from the ISO and burn them to a CD (if you want to add additional files). Access is the same as above.
  • Extract the files from the ISO and pack them into a Zip archive (if you're pressed for space on the CD). You can then extract the files from the archive on drive D: like this:

    Set sa  = CreateObject("Shell.Application")
    Set zip = sa.NameSpace("D:\your.zip")
    Set dst = sa.NameSpace("C:\destination\folder")
    
    For Each f In zip.Items
      dst.CopyHere(f)
    Next
    

    Note that CopyHere is asynchronous, so it returns immediately, but you may need to wait some time for the extraction to finish.

Upvotes: 0

Related Questions