VMware Cloud Community
lukeglazebrook
Enthusiast
Enthusiast

Report to detail VM socket and core details per cluster for the estate for the purposes of MS licencing

Hi,

I suspect someone has done something like this before, I have been asked to by the licencing manager if I could pull a report for the entire estate providing the following criteria...

- All VM's

- Their respective cluster

- The socket configuration

- Core configuration

I Had a bit of a look on the internet and surprisingly not found this, wondered if anyone could kindly share if they have done something similar (I'm sure someone must have).  Licencing is not my specialist area to be honest and I'm also not sure its the licencing managers either so hopefully I will provide what he is after. 

3 Replies
LucD
Leadership
Leadership

Try something like this

foreach($cluster in Get-Cluster){

    Get-VM -Location $cluster |

    Select Name,@{N='Cluster';E={$cluster.Name}},

        @{N='Socket';E={$_.ExtensionData.Config.Hardware.NumCPU/$_.ExtensionData.Config.Hardware.NumCoresPerSocket}},

        @{N='Core/Socket';E={$_.ExtensionData.Config.Hardware.NumCoresPerSocket}}

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
lukeglazebrook
Enthusiast
Enthusiast

Wow thanks mate,

I just tried to amend it so it exports to a CSV by adding the following...  Can you please educate me please and tell me how I am being a dipstick

Exporting.JPG

LucD
Leadership
Leadership

You would have to do the export after the loop, but there the issue might be that the ForEach doesn't place anything in the pipeline.

One solution is to use the call operator (&) with a codeblock around the ForEach.

Then you can pipe the result to an Export-Csv

Something like

&{foreach($cluster in Get-Cluster){

    Get-VM -Location $cluster |

    Select Name,@{N='Cluster';E={$cluster.Name}},

        @{N='Socket';E={$_.ExtensionData.Config.Hardware.NumCPU/$_.ExtensionData.Config.Hardware.NumCoresPerSocket}},

        @{N='Core/Socket';E={$_.ExtensionData.Config.Hardware.NumCoresPerSocket}}

}} | Export-Csv cpu-report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference