Hi
I deployed a bunch of VMs from a template and trying to customize them as per the requirement. I referred to one of the post and used the below code. The settings of the vms changed but the image is corrupted all the time.
## get the VM object
$vmVMSTORE23 = Get-VM VMSTORE23
## set the harddisk storageformat to thin
$vmVMSTORE23 | Get-HardDisk | Set-HardDisk -StorageFormat Thin
## set the SCSI controller type
$vmVMSTORE23 | Get-ScsiController | Set-ScsiController -Type VirtualLsiLogicSAS
I tried the other way adding a new scsi controller and moving the existing hard disks to the new scsi controller. The one hard disk created along deployment from a template is not moving to new scsi controller and vm is trying to boot from scsi node 1:0 and not from scsi node 0:1. Here is code snap I used
$VirtualMachinesDetails | %{ New-HardDisk -VM $_.Name -CapacityGB 1 -Datastore (Get-Datastore $_.Datastore) -Persistence IndependentNonPersistent -Confirm:$false } (Hard disk 2)
$VirtualMachinesDetails | %{ New-HardDisk -VM $_.Name -DiskType $_.rawtype -Devicename $_.rdm1 -Confirm:$false } (Hard disk 3)
$VirtualMachinesDetails | %{ New-HardDisk -VM $_.Name -DiskType $_.rawtype -Devicename $_.rdm2 -Confirm:$false } (Hard disk 4)
$disk = $VirtualMachinesDetails | %{Get-HardDisk -VM $_.Name | Select -First 4}
$VirtualMachinesDetails | %{New-ScsiController -HardDisk $disk -Type $_.Type}
Someone please help me with this.
Thanks in advance
Sai