I'm hoping someone with a much better understanding of scripting than I will know of a simple way of doing this?
Basically, here is the scenario...
We use NFS Datastores running on Netapp Filers to house all of our Virtual Machines. This normally works great however we have had a few incidents recently with the filer which has meant us having to switch to our snapmirrored backups. Basically how this works is that each datastore, say for example Datastore1 normally runs on Filer1. This datastore is regulary 'snapmirrored' across to Filer2. this snapmirror is a readonly copy of the datastore. If we have a problem with Filer1, it is possible to reconfigure Filer2 to make the backup snapmirror writeable, effectively allowing us to see the vm's again.
Currently, if this happens, in order to get the Vm's back we need to remove all the vm's from Virtual Center Inventory, then add the snapmirrored datastore to all the hosts in Virtual Center, then Browse the datastore and manually add back all the vm's individually by doing the usual right click/add to inventory on each vm.
As i say we recently had an issue and had to invoke this for 10 datastores housing almost 250 vm's so as you can imagine was quite a slow and labour intensive task!!!
What i've been trying to work out is how i could script this in Power CLI? I've seen LuCD's excellent looking add .vmx script and looks very similar to what i'd like to do but can't work out how to modify it for my purposes.
What id' ideally love to get to would be a script that i can specify a Virtual Center instance, Datastore and Cluster as variables (say vcname$ = "ukvir0001" , cluster$ = "Datacentre1" and dsname$ = "datastore1") and then have the script read the datastore and add any .vmx's it finds to the specified Cluster.
I've been reading with interest the new Datastore Provider functionality in PowerCLI4 and that sounds like something that may provide an easy way of doing it i just can't work out how!
Any help would be very much appreciated as i have the daunting task of having to move almost 250 vm's back over to Filer1 now that the filer has been repaired and don't have the luxury of a several hour maintenance window to do it manually!