mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
21 lines
609 B
PowerShell
21 lines
609 B
PowerShell
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
#Requires -Modules VagrantMessages
|
|
|
|
param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$VmId,
|
|
[Parameter(Mandatory=$true)]
|
|
[Int32]$ControllerNumber,
|
|
[Parameter(Mandatory=$true)]
|
|
[Int32]$ControllerLocation
|
|
)
|
|
|
|
try {
|
|
$vm = Hyper-V\Get-VM -ID $VmId
|
|
Hyper-V\Remove-VMDvdDrive -ControllerNumber $ControllerNumber -ControllerLocation $ControllerLocation -VMName $vm.Name
|
|
} catch {
|
|
Write-ErrorMessage "Failed to remove DVD drive (Location: '${ControllerLocation}' Number '${ControllerNumber}'): ${PSItem}"
|
|
exit 1
|
|
}
|