ESXI shell register all the *.vmx files in datastore/s

Using below bash script we can register all the vms in datastores with ESXi host.This has tested in vSphere 6.5 & 6.7 Hol


for myvm in $(find / -name *.vmx);


vim-cmd solo/registervm $myvm


if we want we can find on specific datastore. please refer the below example

find /vmfs/voluems/datastore10R10/ -name *.vmx

(datastore10R10 is my datatore name)