Created
December 11, 2013 18:50
-
-
Save jcpowermac/7916185 to your computer and use it in GitHub Desktop.
Virtual machines that are not connected to their network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $vmview = Get-View -ViewType VirtualMachine | |
| $vmview | % { | |
| if( $_.Runtime.PowerState -eq "poweredOn" ) { | |
| $netdev = $_.Config.hardware.Device | Where {$_.MacAddress} | |
| if(!($netdev.Connectable.Connected) ) { | |
| $hostname = (Get-View -id $_.Runtime.Host).Name | |
| Write-Host $_.Name $netdev.Backing.Port.PortKey $hostname | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment