set-vi3-entity switch code for scripts

set-vi3-entity switch code for scripts

This is a script header I built when I realized that most scripts I wrote would go against an array "$vmhosts" containing host objects. This could be one host, a cluster's hosts, or all hosts in a virtual center.


If you want to write a script that will take ESX host objects in an array $vmhost, just put your Foreach Loop or what have you at the end of this text file. Your script will prompt you for Host, Cluster, Or VC.. then grab the appropriate hosts and shove them in to the array $vmhosts. I'm sure it can be improved on nicely or prettied up.. but it does the job for me for now. I thought i'd share it as I have used it a lot.

Tags (1)
Version history
Revision #:
1 of 1
Last update:
‎02-04-2009 12:38 PM
Updated by: