Get-VMHost | Foreach-Object {
## get the GenericMeasureInfo for this host's datastores, to be used for the output
$mioThisHostsDStoreInfo = Get-Datastore -VMHost $_ | Measure-Object -Property CapacityGB,FreeSpaceGB -Sum
$dblCapGB = ($mioThisHostsDStoreInfo | ?{$_.Property -eq "CapacityGB"}).Sum ## datastore capacity
$dblFreeGB = ($mioThisHostsDStoreInfo | ?{$_.Property -eq "FreeSpaceGB"}).Sum ## datastore free
Select -InputObject $_ @{n="hostname"; e={$_.NetworkInfo.HostName}},
@{n="IP"; e={($_.NetworkInfo.VirtualNic | ?{$_.ManagementTrafficEnabled -eq $true -and $_.IP}).IP}},
Model,ProcessorType,CpuTotalMhz,CpuUsageMhz,
@{n="CputAvailableMhz"; e={$_.CpuTotalMhz - $_.CpuUsageMhz}},MemoryTotalGB,MemoryUsageGB,
@{n="MemAvailableGB"; e={$_.MemoryTotalGB - $_.MemoryUsageGB}},
@{n="TotalDStoreSizeGB"; e={$dblCapGB}},
@{n="DStoreUsedGB"; e={$dblCapGB - $dblFreeGB}},
@{n="DStoreAvailableGB"; e={$dblFreeGB}},
@{n="PNicCount"; e={($_.NetworkInfo.PhysicalNic | Measure-Object).Count}}
} ## end foreach-object
Export-Csv -Path "VMs.csv" -NoTypeInformation -UseCulture
i am not able to export the output into csv file and i dnt know what you mean here " uncommited space" using your script i can get the total , free and available spaces also.