What about using RVTools to export any kind of informations from vCenter? It is free, fast and genius...
I was working on a simliar script to export data, but found this tool and it just gives me everything that anyone can need.
*** If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful! ***
vExpert 2019, VCAP-DCA,VCP,MCSE,MCITS and some more...