1. SSH to the Primary Cell using Putty or other SSH Client
2. Login to the Postgres database: sudo -u postgres psql vcloud
3. Execute the query below:
***NOTE: This only impacts VMs with NULL dstore_moref values and has no impact on functional VMs***
select 'update vm set dstore_moref = ' || '''' || datastore_inv.moref || '''' || ' where id = ' || '''' || vm.id || '''' || ';' from vm
inner join vapp_vm on vapp_vm.svm_id = vm.id
inner join vm_inv on vm_inv.moref = vm.moref
inner join datastore_inv on datastore_inv.vc_display_name = (substring(vm.location_path,2,(POSITION(']' in vm.location_path))-2))
where vm.dstore_moref is NULL and vm_inv.is_deleted is false;