Find Virtual Machine
by Chris Kranz on Jan.20, 2009, under Command Line
Can’t remember which datastore a certain virtual machine is on and you’re on the command line only? Can happen, honest! In conjunction with other scripts, this can be quite helpful though. Just call the script and pass it the server name you are looking for.
[root@esx007 root]# cat find_server.sh
#!/bin/sh
echo Locating server $1
ls -1F /vmfs/volumes/ | grep @ | cut -d @ -f 1 | while read dir; do
find /vmfs/volumes/${dir}/ -iname ${1}*
done










































