title: Adding the device 'Microsoft:Hyper-V:Virtual CD/DVD Disk' to 'VMNAME' failed
body: <p>I am writing a script that should help me automate deployments of my Hyper-V VMs testing environments. Right now I want new VMs to be created with empty VHDX drives and Windows installation ISO attached as a virtual DVD drive.</p>
  
  <p>I've created several VMs with the <code>New-VM</code> cmdlet. However, it appears that this cmdlet does not have an option to attach the ISO when creating a new virtual machine. It appears that I have to use the <code>Add-VMDvdDrive</code> PowerShell cmdlet. Correct?</p>
  
  <p>However, when I run the following command, I get an error:</p>
  
  <p><code>Add-VMDvdDrive -VMName "VMNAME" -Path "F:\WindowsServer2012R2.iso</code></p>
  
  <p>Here is the error:</p>
  
  <pre><code>Add-VMDvdDrive : Adding the device 'Microsoft:Hyper-V:Virtual CD/DVD Disk' to 'VMNAME' failed.
  At C:\Users\user\Documents\vmdeploy.ps1:3 char:1
  + Add-VMDvdDrive -VMName "svn1.contoso.com" -Path "F:\WindowsServer2012 ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [Add-VMDvdDrive], VirtualizationException
      + FullyQualifiedErrorId : Unspecified,Microsoft.HyperV.PowerShell.Commands.AddVMDvdDrive
  </code></pre>
  
  <p>What am I doing wrong?</p>