Friday, June 10, 2016

Hyper-V media disconnection

Got an issue with Hyper-V servers connected to media?

Run this.



[string[]]$cn = Get-ADComputer -Filter * -SearchBase 'OU=Hypervisors,OU=Services,DC=internal' | select -ExpandProperty dnshostname
$vm = Get-VM -ComputerName $cn -Name *
$vm | Get-VMDvdDrive | ? DvdMediaType -ne None | Set-VMDvdDrive -Path:$null

No comments:

Blog Archive