Thursday, May 14, 2015

Add multiple (1000s) of datastores to a host or a cluster

We had a vBlock datacenter which we were building for a customer and we had to add 100s of datastores and like a lazy person i am , i wanted it to be done by someone else. Since there was no one else to do it for me i thought of making the powercli do it for me.
Use the notepad++ alt+shift and arrow keys to replicate the same command for just 1 host of the cluster against multiple naa... ids and copy paste the entire chain on a powercli. Once all the datastores are added to a cluster then just right click the cluster and rescan for datastores.

new-datastore -vmhost "superhero.marvel.com" -Name "CaptainAmerica" -path "naa.6006016054303c009430d2accaf8e411" -vmfs -FileSystemVersion 5

note: the -filesystem version 5 is optional or unnecessary since by default it will take the latest vmfs version if nothing is mentioned.