Adding totals for some to this script

$Report = @)

Get-datastore abc123. Select-Object - property name,

@{N = "CapacityGB"; E = {[math]: tour ($_.)} (CapacityGB, 0)}}, @{N = "FreeSpaceGB"; E = {[math]: tour ($_.)} (FreeSpaceGB, 0)}} | FreeSpaceGB tri-objet | name tri-objet | % {

$ReportRow = "" | Select-Object Name, CapacityGB, FreeSpaceGB, UsedGB

$ReportRow.Name = $_. Name

$ReportRow.CapacityGB = $_. CapacityGB

$ReportRow.FreeSpaceGB = $_. FreeSpaceGB

$ReportRow.UsedGB = $_. CapacityGB - $_. FreeSpaceGB

$ReportRow.SizeGB = $_. SizeGB

$Report += $ReportRow

}

The following books... but I really need at the bottom of the above, the totals of output... im not sure how to integrate it into my little script.

so I would really like that...

....

....

....

Total capacityGB

Total freespaceGB

Total usedGB

advice please...

Try something like this

$Report = @)

Get-Datastore abc123. Select-Object - property name,

@{N = "CapacityGB"; E = {[math]: tour ($_.)} (CapacityGB, 0)}},

@{N = "FreeSpaceGB"; E = {[math]: tour ($_.)} (FreeSpaceGB, 0)}} |

Sort-Object Name, FreeSpaceGB. % {

$ReportRow = "" | Select-Object Name, CapacityGB, FreeSpaceGB, UsedGB

$ReportRow.Name = $_. Name

$ReportRow.CapacityGB = $_. CapacityGB

$ReportRow.FreeSpaceGB = $_. FreeSpaceGB

$ReportRow.UsedGB = $_. CapacityGB - $_. FreeSpaceGB

$Report += $ReportRow

}

$ReportRow = "" | Select-Object Name, CapacityGB, FreeSpaceGB, UsedGB

$ReportRow.Name = "totals".

$ReportRow.CapacityGB = $report | Measure-object-property CapacityGB-sum | Select sum - ExpandProperty

$ReportRow.FreeSpaceGB = $report | Measure-object-property FreeSpaceGB-sum | Select sum - ExpandProperty

$ReportRow.UsedGB = $ReportRow.CapacityGB - $ReportRow.FreeSpaceGB

$Report += $ReportRow

$Report | FT - AutoSize

Tags: VMware

Similar Questions

Maybe you are looking for

  • New iMac and Macbook Pro to run Snow Leopard?

    Hello, I just record music using Garageband that runs on Snow Leopard. My old 2008 iMac is dying and I need to know: what is the newest iMac or Macbook Pro which will be held in Snow Leopard? Thank you!

  • screen fade

    HelloI have a new problem now with my Sony Xperia z2... The color of the screen changes automatically... When I take a screenshot, or click on a picture of my camera... wwhen view you the picture later, the picture is normal for 3 seconds... then the

  • Photosmart 7960: Photosmart 7960: color printing problem print Brown instead of Red

    Instead of printing red print Brown.

  • Ghost car blocks disk access USB external?

    I have a WD MyBook drive on an external USB connection. No particular reason, I can relate, he arrested recognized by my system Win7. He has worked before, but now, instead of him in the 'Computer' window, I have a completely false Ghost with a new d

  • Need help with password lock screen

    Dear Sir I can't lock screen with password in my window 7 64 bit OS. Kindly tell me how to lock the screen with password