How can I add and remove physical USB disk drives via Powershell to a VM in Hyper-V?
I've been struggling to find a successful solution to this:
I'm using multiple USB HDD's with my Veeam backup setup which is on a Hyper-V virtual machine. Right now I have to go into hyper-v manager and then go to the settings of the VM to swap the drives out. Under settings I can select the drive, then click the remove button. THen swap out the drive (each week) and then go back under settings and add a new drive. This continues to map each drive under my VM as drive letter E, which is what I want, and this has been working fine.
However, I'd like to be able to automate the removal and addition of new drive with scheduled tasks. Can anyone provide any examples of how this could be done with powershell and or diskpart?