Tag Archives: get-isomounts

For almost a year ago, I posted a simple one-liner to list all VMs who has ISOs mounted. You can view that post here: http://cloud.kemta.net/2013/10/powershell-vmware-list-all-vms-with-iso-mounted-and-dismount-them/ That post was written before I truly discovered the major advantages of using Get-View instead of Get-VM, Get-VMHost and so on. If used correctly, there’s a major difference in speed when using Get-View over Get-VM. When writing this post I checked the differences in speed when using the old way that I linked to above and my new function (which I’ll get to in a second or two..), the result was as follows: As you can see, the difference is pretty clear. 5 seconds vs. 1.6 minutes… So, without further ado, I present to you the code for Get-ISOMounts: function Get-ISOMounts { [CmdletBinding()] Param ( [switch]$Dismount ) $VMs = Get-View -ViewType virtualmachine -Property name,Config.Hardware.Device $VMsWithISO = @() $progress = 1 foreach ($VM in $VMs) { Write-Progress -Activity…

Read more

1/1