locked
Change VM HD from SCSI to IDE? RRS feed

  • Question

  • Wondering how to change your VS/VPC VM hard drive config from SCSI to IDE (because once you move it to Hyper-V, you cannot boot from SCSI)?
    Tony Soper
    Friday, October 10, 2008 8:28 PM

Answers

  • '==========================================================================
    '
    ' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.1
    '
    ' NAME:
    '
    ' AUTHOR: richardCarpenter , Microsoft Corp
    ' DATE  : 9/21/2008
    '
    ' COMMENT: checks the disk adapters and type and if it is SCSI it changes
    ' the type to IDE
    '
    '==========================================================================
    option explicit

    'On Error Resume Next

    dim id
    dim rtn
    dim objvs
    dim colvms
    dim objvm
    dim colArgs
    DIM hdskConnections
    dim objhdskconnection
    dim objHardDisk
    dim strfile

    Set objVS = CreateObject("VirtualServer.Application")

    set colVMs = objVS.VirtualMachines
    set colArgs = wscript.Arguments
     
    id = 0

    For Each objVM in colVMs
        If objVM.Name = colArgs.item(0) then
         set hdskConnections = objVM.HardDiskConnections
         For Each objhdskconnection In hdskConnections
                    set objHardDisk = objhdskconnection.HardDisk
      strFile  = objHardDisk.File
                    wscript.echo "VM Disk File" & strfile
             If objhdskconnection.BusType = 1 Then
                rtn = objhdskconnection.SetBusLocation (0,0,id)
         id = id+1
             End If
         Next
     End if
    Next


     


    Tony Soper
    • Marked as answer by tonyso Friday, October 10, 2008 8:29 PM
    Friday, October 10, 2008 8:29 PM
  • Ugh... nevermind. Its a simple thing that a noob like me can't figure out - this is designed to be run on the virtual server host at a command prompt with the targeted virtual guest machine name listed.

    eg. - c:\VM_SCSItoIDE.vbs TestMachine


    Its that flippin simple. For any other noob trying to do this, thats how you do it. 

    Edit - the server name is CaSe SeNsItIvE...TestMachine is not testMachine.
    • Marked as answer by tonyso Thursday, November 26, 2009 10:30 PM
    Thursday, November 26, 2009 6:25 PM

All replies

  • '==========================================================================
    '
    ' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.1
    '
    ' NAME:
    '
    ' AUTHOR: richardCarpenter , Microsoft Corp
    ' DATE  : 9/21/2008
    '
    ' COMMENT: checks the disk adapters and type and if it is SCSI it changes
    ' the type to IDE
    '
    '==========================================================================
    option explicit

    'On Error Resume Next

    dim id
    dim rtn
    dim objvs
    dim colvms
    dim objvm
    dim colArgs
    DIM hdskConnections
    dim objhdskconnection
    dim objHardDisk
    dim strfile

    Set objVS = CreateObject("VirtualServer.Application")

    set colVMs = objVS.VirtualMachines
    set colArgs = wscript.Arguments
     
    id = 0

    For Each objVM in colVMs
        If objVM.Name = colArgs.item(0) then
         set hdskConnections = objVM.HardDiskConnections
         For Each objhdskconnection In hdskConnections
                    set objHardDisk = objhdskconnection.HardDisk
      strFile  = objHardDisk.File
                    wscript.echo "VM Disk File" & strfile
             If objhdskconnection.BusType = 1 Then
                rtn = objhdskconnection.SetBusLocation (0,0,id)
         id = id+1
             End If
         Next
     End if
    Next


     


    Tony Soper
    • Marked as answer by tonyso Friday, October 10, 2008 8:29 PM
    Friday, October 10, 2008 8:29 PM
  • ??

    Where do you run this script?  In each VM?

    Can't you just change the virtual machines from SCSI to IDE using options in Virtual Server or VMM 2005 instead?
    Wednesday, April 29, 2009 9:59 PM
  • Is there anyone here?
    There is just code pasted into the answer with no explanation. 
    Do you run this script from inside each guest VM's OS? 
    • Proposed as answer by Roy Chastain Sunday, March 4, 2012 2:26 PM
    Tuesday, May 26, 2009 5:26 PM
  • Run the script on the Virtual Server machine before you perform the Copy to the new target host.


    tony soper
    Friday, June 19, 2009 6:26 PM
  • Do you have to somehow point it to the directory containing the vhds and specify which vms to check?
    Friday, June 19, 2009 6:42 PM
  • This script is pulling from the virtual server configuration information through COM and makes the changes to each VM configuration file using the COM interface to change from SCSI to IDE interface.  
    As necessary background you should read up on VM migration: http://social.technet.microsoft.com/Search/en-US/?query=vm%20migration&ac=8

    You must to start up each VM and remove the VM add-ins before running this script.

    An issue you might run into is with the HAL, because hardware platforms presents a different Hardware virtualization configuration than Hyper-V does, so the machine may not boot up correctly on the target host.  To work around this you must make a change to the boot settings, using  MSConfig.exe:

    1. To do this, click Start, click Run, type msconfig, and then click OK
    2. Click the Boot tab, and then click Advanced options.
    3. Select the Detect HAL check box, click OK, and then restart the virtual machine


    tony soper
    Friday, June 19, 2009 7:33 PM
  • Hi Tony,

    I'm newbie in scripting. I cannot run the script on Windows 2000 Machines. The system reports ChgVMSCSI_IDE.vbs(28,1) Microsoft VBScript runtime error: ActiveX component can't create object: 'VirtualServer.Application'

    Can the SCSI device of the Windows 2000 VM be changed?

    TIA

    M
    Thursday, October 22, 2009 3:47 AM
  • Thanks for the script tony, its greatly appreciated. Unfortunately, I'm having an issue trying to run it. I get a "subscript out of range error" on line 36 char 5. Does anyone have any ideas why?
    Thursday, November 26, 2009 3:07 PM
  • Checking with script author...will report back as soon as I have an answer or suggestion for you.
    tony soper
    Thursday, November 26, 2009 5:18 PM
  • Ugh... nevermind. Its a simple thing that a noob like me can't figure out - this is designed to be run on the virtual server host at a command prompt with the targeted virtual guest machine name listed.

    eg. - c:\VM_SCSItoIDE.vbs TestMachine


    Its that flippin simple. For any other noob trying to do this, thats how you do it. 

    Edit - the server name is CaSe SeNsItIvE...TestMachine is not testMachine.
    • Marked as answer by tonyso Thursday, November 26, 2009 10:30 PM
    Thursday, November 26, 2009 6:25 PM
  • Hi,

    I have tried the script but I have an error message

    On the hot server, command prompt, c:\VM_SCSItoIDE.vbs MACHINE

    A message box appear with VM Disk File D:\DATA\Machines_Virtuelles\INTERNES\MACHINE\MACHINE.vhd

    A second message box appear with an error :

    line 43, caract 13, the operation failed. the bus location is already in use, code A0040503, source null

    The VM additions have been uninstalled and the machine is well stopped

    Wednesday, May 26, 2010 8:32 AM
  • The reason was that the prior ide canal 0 was used by the CD/DVD
    Wednesday, May 26, 2010 9:24 AM