Comments on: Add ISO DVD Drive to a Hyper-V VM using PowerShell https://www.thomasmaurer.ch/2020/08/add-iso-dvd-drive-to-a-hyper-v-vm-using-powershell/ Cloud and Datacenter Blog focusing on Microsoft Azure Fri, 24 Sep 2021 12:22:42 +0000 hourly 1 https://wordpress.org/?v=6.4.1 By: Tolga Balcı https://www.thomasmaurer.ch/2020/08/add-iso-dvd-drive-to-a-hyper-v-vm-using-powershell/#comment-859424 Fri, 24 Sep 2021 12:22:42 +0000 https://www.thomasmaurer.ch/?p=16575#comment-859424 OK – Solved after getting DVD device list with Get-VMDvdDrive and using the -ControllerNumber and -ControllerLocation options.

]]>
By: Tolga Balcı https://www.thomasmaurer.ch/2020/08/add-iso-dvd-drive-to-a-hyper-v-vm-using-powershell/#comment-859422 Fri, 24 Sep 2021 09:48:08 +0000 https://www.thomasmaurer.ch/?p=16575#comment-859422 Great one Thomas, right to the point.
Just one note though. It seems that the cmdlet is expecting a controller number. Running the command without specifying the controller resulted in this error (DVD was already added to the SCSI controller before running the cmdlet):

PS C:\Users\tolga> Set-VMDvdDrive -VMName “RHEL 8.4” -Path “”C:\Users\tolga\Downloads\Software.iso””
Set-VMDvdDrive : Cannot bind parameter ‘ControllerNumber’. Cannot convert value “C:\Users\tolga\Downloads\Software.iso” to type “System.Int32”. Error: “Input string was not in a correct format.”
At line:1 char:50
+ … 1″ -Path “”C:\Users\tolga\Downloads\Softwar …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-VMDvdDrive], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.HyperV.PowerShell.Commands.SetVMDvdDrive

Despite the error, when I switched to the Hyper-V Manager and checked the VM, I could see the ISO file mounted under VM Settings > SCSI Controller > DVD Drive.

After the error, I also tried the same cmdlet above by setting the -ControllerLocation 1 but the error did not change.

Any ideas?

]]>