Disconnect datastore iso (if exists) from all virtual machine on your virtual center

Posted on 19 dicembre 2014 di

0


Simply Copy&Paste the code in a .ps1 powershell script.


Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer Vcenter
$VMs=Get-VM
foreach ($VM in $VMs) {
$DsIso = Get-CDDrive -VM $VM | Select IsoPath,@{N="VM";E={$_.Parent.Name}}
if ($DsIso.IsoPath -ne $null) {
Get-CDDrive -VM $VM | Set-CDDrive -NoMedia -Confirm:$false
}
}
Disconnect-VIServer Vcenter -Confirm:$false

Annunci