Thanks Luc,
So I'm making some progress I just need to figure out how to get the world for the NetWorld.. In addition I needed to change a bit of the code to get the VMXCartelID by replacing $esxcli.vms.vm.list() with $esxcli.vm.process.list() I'm on 6.7 perhaps its changed
Would you be able to help with getting the NetWorld ?
$vmName = "MyVMName"
$esxcli = Get-EsxCli
$vmxid = $esxcli.vm.process.list() | where {$_.DisplayName -eq $vmName} | Select VMXCartelID
$esxtopInterval = 5
$conversion = 100 / (1e6 * $esxtopInterval)
$first = $true
$report = @()
for ($i = 0; $i -lt 10; $i++) {
$stats = Get-EsxTop -CounterName VCPU | where {$_.VCPUID -eq $vmxid.VMXCartelID}
if (!$first) {
$row = "" | Select VCPUID, WorldName, Run, Ready
$row.VCPUID = $stats.VCPUID
$row.WorldName = $stats.WorldName
$row.run = "{0:p1}" -f (($stats.RunTimeInUsec - $run) * $conversion)
$row.ready = "{0:p1}" -f (($stats.ReadyTimeInUsec - $ready) * $conversion)
$report += $row
}
else {
$first = $false
}
$run = $stats.RunTimeInUsec
$ready = $stats.ReadyTimeInUsec
sleep $esxtopInterval
}
$report | ft -AutoSize