Created
February 7, 2019 15:47
-
-
Save gswallow/addb3bd6af1dbc350e19a9bc76d97a02 to your computer and use it in GitHub Desktop.
Find VMs by MAC address
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
#!/bin/bash | |
for vm in $(govc find -i=true / -type m); do | |
govc object.collect -json=true $vm config | jq -r '.[] | select(.Val.Hardware.Device[].MacAddress == "00:50:56:b4:0a:1b") | .Val.Name' | |
govc object.collect -json=true $vm config | jq -r '.[] | select(.Val.Hardware.Device[].MacAddress == "00:50:56:b7:06:6f") | .Val.Name' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment