HyperVDsc icon indicating copy to clipboard operation
HyperVDsc copied to clipboard

VMDvdDrive: Get-VMIdeController fails on Gen 2 VM

Open iainbrighton opened this issue 8 years ago • 0 comments

When attempting to attach an ISO to Generation 2 VM, it fails when calling Get-VMIdeController with the following error:

Get-VMIdeController : Generation 2 virtual machines do not support IDE.
At C:\Users\Iain\Dropbox\PowerShell\Modules\Lability\DSCResources\xHyper-V\DSCResources\MSFT_xVMDvdDrive\MSFT_xVMDvdDrive.psm1:396 char:20
+ ...  -and -not (Get-VMIdeController -VMName $VMName -ControllerNumber $Co ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-VMIdeController], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVMIdeController

Adding -ErrorAction SilentlyContinue to the Get-VMIdeController call in the Test-ParameterValid method does appear to resolve the problem.

iainbrighton avatar Aug 16 '17 12:08 iainbrighton