Ok, so here is the command you can use to get the VM Name, Guest OS Details and Datacenter Details...
Get-VM | Select Name, Guest, @{N="Datacenter";E={Get-Datacenter -VM $_}}
To export the result in CSV, you can use it like below:
Get-VM | Select Name, Guest, @{N="Datacenter";E={Get-Datacenter -VM $_}} | Export-Csv D:\Test.CSV
Thanks,
Amit