Hello Community,
I currently try to upload a vmdk (virtual disk file) to a vm on Vsphere
The vmdk is from an ova file
This is how I try to do it with powercli:
// connect to server
Connect-VIServer -Server domain.to.my.server.net
// Create a new vm
New-VM -Name "vm-name" -Datastore "global-sas-harddrives" -NumCpu 2 -MemoryGB 4 -NetworkName "networkName" -VMHost "domain.to.vmHost.net" -Location "foldername"
// upload the local vmdk to a folder in a datastore
$ds = Get-Datastore -Name "global-sas-harddrives"
New-PSDrive -Location $ds -Name DS -PSProvider VimDatastore -Root "\" > $null
Copy-DatastoreItem -Item "C:/path/to/disk.vmdk" -Destination "ds:/datastore-folder-name/disk.vmdk"
// copy the vmdk file to the folder of the newly created VM
Copy-DatastoreItem -Item "ds:/datastore-folder-name/disk.vmdk" -Destination "ds:/vm-name/vm-name_bootdisk.vmdk"
// everything upt to here seems to work fine but now i am struggling
// I tried:
New-HardDisk -VM "vm-name" -DiskPath "[global-sas-harddrives] vm-name/vm-name_bootdisk.vmdk"
// but here I get: Incompatible device backing specified for device '0'.
// I also tried the solution from a forum post from 2014 https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Adding-copied-harddisk-VMDK-to-a-VM/m-p/979840
add-HD -VMname "vm-name" -Filename "[global-sas-harddrives] vm-name/vm-name_bootdisk.vmdk" -Controller "SCSI Controller 0"
// here the task seems to go through without visible errors, but in the webgui it the drive has 0MB space
// and the webgui says "Some of the disks of the virtual machine vm-name failed to load. The information present for them in the virtual machine configuration may be incomplete"
Does anyone have an Idea what the problem is.
And how I can further debug this Issue.
Thanks a lot