Wednesday, February 24, 2016

Add Multiple VMs to Inventory

I was recently in a situation where I had to remount and NFS datastore to my ESXi hosts due to an IP address change.  After shutting down all the VMs in that datastore, I chose the entire group and right-click > remove from inventory.  After unmounting the datastore I re-added it again with the new IP address.  Now I had a datastore but it showed no VMs.  When browsing the contents of the datastore I was able to see all the machines.  However, I had no interest in going into each VM folder, and adding each one separately to the inventory.  

If found a Powershell (needs PowerCLI) script that does it quite well:  

One note regarding the script on the site, for some reason instead of actual quotation marks (" ") instead the script has "

You will need to replace each one prior to running the script.

No comments:

Post a Comment