Hi All,
I have created a new VM on my ESXi 4.0 using PowerCLI and I am able to attach my VMDK to it. I using following command todo this:
> New-VM -Name TestVM1 -DiskPath "[DEV] BESR/dev2-besr-xp_C_E_Drive.vmdk" -VMHost 101.397.91.74 -DiskMB 40000 -MemoryMB 2560
And now when I am starting the VM using "start-VM TestVM1" it is not booting up. The reason being it is trying to use the default VMDK created with the VM for booting and it is not able to find any OS in it.
I want the VM to boot from my VMDK. (If I remove the default VMDK from vSphere then the VM can boot successfully using my VMDK.)
Any pointers how can I make the VM use my VMDK for booting using PowerCLI.
Thanks in advance.
Regards,
Ganesh
If you remove the -DiskMB parameter from your command only the vmdk will be connected. Like in this example:
PowerCLI> new-vm -name proefkonijn -vmhost scomp0407.wurnet.nl -diskpath "[vito_vmfs01] proefkonijn2/proefkonijn2-000001.vmdk" -memoryMB 2560 Name PowerState Num CPUs Memory (MB) ---- ---------- -------- ----------- proefkonijn PoweredOff 1 2560 PowerCLI> get-vm proefkonijn | get-harddisk CapacityKB Persistence Filename ---------- ----------- -------- 26214400 Persistent ...o_vmfs01] proefkonijn2/proefkonijn2-000001.vmdk
Perhaps not the answer to what you asked, but can't you just remove the original harddisk ?
This can be done with the Remove-Harddisk cmdlet.
Something like this
New-Vm ... | Get-Harddisk | Remove-Harddisk -Confirm:$false
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Well I would try and change the order of the vmdk on the vm you can change the SCSI numbers of them. Not sure if this is possible with powercli but i would try that.
If you remove the -DiskMB parameter from your command only the vmdk will be connected. Like in this example:
PowerCLI> new-vm -name proefkonijn -vmhost scomp0407.wurnet.nl -diskpath "[vito_vmfs01] proefkonijn2/proefkonijn2-000001.vmdk" -memoryMB 2560 Name PowerState Num CPUs Memory (MB) ---- ---------- -------- ----------- proefkonijn PoweredOff 1 2560 PowerCLI> get-vm proefkonijn | get-harddisk CapacityKB Persistence Filename ---------- ----------- -------- 26214400 Persistent ...o_vmfs01] proefkonijn2/proefkonijn2-000001.vmdk