Automation

 View Only
  • 1.  Adding HD to VM, but I need it on the second SCSI controller

    Posted May 07, 2012 09:17 PM

    This should be relatively easy but for some reason is not.  I'm trying to add a hard disk using New-Harddisk, but I need to use the -Controller switch.  I just can't quite figure out where the scsi controller names are.

         Get-Cluster -name “TESTCLUSTER” | Get-VM -name TESTVM_* | ForEach {
           New-harddisk -vm $_ -CapacityKB 1073741824 -Controller ????
           }

    I've tried a few different things but I won't list them all here.  I repeatedly get a message from PowerCLI "Could not ScsiController with name xxxx".  This should be very easy but I can't seem to find any samples that cover this switch, nor does the documentation seem to have any samples.

    Thanks in advance!

    Brent



  • 2.  RE: Adding HD to VM, but I need it on the second SCSI controller
    Best Answer

    Posted May 07, 2012 10:00 PM

    Get-Cluster -name “TESTCluster” | get-vm -name TESTVM_* | foreach {New-HardDisk $_ -Capacity 1073741824 -Controller “SCSI Controller 1”}

    To get scsi controller name

    Get-vm testvm | get-scsicontroller | format-list

    Message was edited by: Zsoldier



  • 3.  RE: Adding HD to VM, but I need it on the second SCSI controller

    Posted May 07, 2012 10:37 PM

    Thank you sir...worked great.