Thursday, January 28, 2016

Dismount VM's DVD on Hyper-V Cluster

$myNodes="node1","node2","node3"
foreach ($node in $myNodes)
{
    $dvd=get-vm -ComputerName $node |Get-VMDvdDrive
    foreach ($item in $dvd)
    {
        if ($item.path -ne $null)
        {
            $myDVD=[array]$myDVD+$item
        }
    }
    Foreach ($item in $myDVD)
    {
        Set-VMDvdDrive $item -path $null
    }
}

No comments:

Post a Comment