Attach a DVD Image to all Virtual Machines

Attaches a DVD image to all the virtual machines on a computer.

VBScript Code


On Error Resume Next

Set objVS = CreateObject("VirtualServer.Application")
set colVMs = objVS.VirtualMachines

For Each objVM in colVMS
    Set colDVDDrives = objVM.DVDROMDrives
    For Each objDrive in colDVDDrives
        errReturn = objDrive.AttachImage _
            ("C:\Virtual Machines\Images\VMAdditions013107.iso")
    Next
Next