We are trying to create a SQL script, which gets the Host of the virtual machine. Further, we are trying to get the information (such as CPU/Cores etc) of this host. Could someone help us with a SQL query? Is hostID in ComplicanceComputer the right field? Which field in the ComplianceComputer table does it map to?
Please help with SQL Query if possible.
Oct 07, 2020 06:08 AM
Hello @flexeranoob,
Does this help as a starting point?
SELECT
cc.ComputerName AS 'Host Computer Name',
cc.NumberOfProcessors AS 'Host Processor Count',
cc.NumberOfCores AS 'Host Core Count',
vm.FriendlyName AS 'VM Friendly Name',
vm.*
FROM VirtualMachine vm
JOIN ComplianceComputer cc ON cc.ComplianceComputerID = vm.HostComplianceComputerID
HTH,
Joseph
Oct 07, 2020 06:28 AM
Hello @flexeranoob,
Does this help as a starting point?
SELECT
cc.ComputerName AS 'Host Computer Name',
cc.NumberOfProcessors AS 'Host Processor Count',
cc.NumberOfCores AS 'Host Core Count',
vm.FriendlyName AS 'VM Friendly Name',
vm.*
FROM VirtualMachine vm
JOIN ComplianceComputer cc ON cc.ComplianceComputerID = vm.HostComplianceComputerID
HTH,
Joseph
Oct 07, 2020 06:28 AM
Thanks! Let me try and see how this works out.
Oct 07, 2020 07:21 AM
No problem. I'd also add the following line at the bottom to clean up the output a bit:
ORDER BY [Host Computer Name] ASC
HTH,
Joseph
Oct 07, 2020 07:26 AM
Thanks. One minor help. How do I join it with the compliancecomputer table so that I can have a row for each VM and its corresponding host.
Oct 07, 2020 07:31 AM
Oct 07, 2020 07:50 AM
Thank you!
Oct 07, 2020 07:59 AM
Hi @jjensen ,
can we also add cluster & vcenter details to this query ?
Oct 07, 2021 12:41 PM