Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

error cloning VDI via powershell: virtual hard disk attach does not have a vhd file path specified..

$
0
0

Hi

I am getting this error:

New-SCVirtualMachine : A Virtual Hard Disk attached to test001-hv.site.com does not have a vhd file path specificed.  (Error ID: 23243, Detailed Error: )
Specify a path to a virtual hard drive file or remove this virtual hard disk.


Script:

get-vmmserver -computerName "vmm2.site.com"
$VMHostGroup = Get-VMHostgroup -Name "vdi"
$HWProfile = Get-HardwareProfile | Where {$_.Name -eq "Windows 7 Site Default"}
$VM = Get-VM | where {$_.Name -eq "w7-clonemachine-hv.site.com"}

$names = "test001-hv.site.com"

#evaluate host-servers

$BestHost = Get-VMHostRating -VMHostGroup $VMHostGroup -HardwareProfile $HWProfile -DiskSpaceGB 25 -VMName New | where {$_.rating -gt 0} | sort-object -property rating -descending 
$currentHost = get-vmhost | where {$_.name -eq $BestHost[0].name}

[string]$path=@($currenthost.vmpaths)

New-SCVirtualMachine  -Name $names -vm $vm -VMHost $currentHost -path $path -OperatingSystem "Windows 7" -Owner "HEF_NT\mrt" -StartAction NeverAutoTurnOnVM -StopAction SaveVM 

Now the clonemachine does indeed have a vhd file etc..

I haven't seen this particular error before... 

the $path variable does contain a path..


Kindest regards, Martin


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>