VMware PowerCLI – How to list VMs with mounted ISO and dismount them
always is the same… when you dismounting or removing datastore you need disconnect mounted iso from all VMs… and this is very boring and time consuming, the easy way is use PowerCli !
Get-VM | Get-CDDrive | select @{N="VM";E="Parent"},IsoPath | where {$_.IsoPath -ne $null}
To get all virtual machines with mounted iso:
Get-VM | Get-CDDrive | where {$_.IsoPath -ne $null} | Set-CDDrive -NoMedia -Confirm:$False
To unmount all iso from all virtual machines:
in my case:
PS C:\> Get-VM | Get-CDDrive | select @{N="VM";E="Parent"},IsoPath | where {$_.IsoPath -ne $null} VM IsoPath -- ------- tka-mng01 [datastore1] iso/SW_DVD9_Win_Server_STD_CORE_2016_64Bit_English_-4_DC_STD_MLF_X21-70526.ISO PS C:\> Get-VM | Get-CDDrive | where {$_.IsoPath -ne $null} | Set-CDDrive -NoMedia -Confirm:$False IsoPath HostDevice RemoteDevice ------- ---------- ------------ PS C:\>
(Visited 9 204 times, 5 visits today)
Pingback: Powershell / PowerCLI Script to List & Unmount ISO on VMWare VMs prior to VxRail 4.5 or 4.7 upgrade - Digital Thought Disruption