I'm using Get-Diskfree function described here: https://binarynature.blogspot.com/2010/04/powershell-version-of-df-command.html
I want to sum all values from Used column, but as I try to call out a specific properties of Get-Diskfree output, I've got nothing, null.
Function is showing output like this:
FileSystem : NTFS
Type : Local Fixed Disk
Volume : C:
Available : somevalue
Computer : somevalue
Used : somevalue
Size : somevalue
FileSystem : NTFS
Type : Local Fixed Disk
Volume : D:
Available : somevalue
Computer : somevalue
Used : somevalue
Size : somevalue
I want to be able to call out Used property by parsing Get-Diskfree output into variable like this:
function {...}
$variable = Get-Diskfree
$variable.Used
Last line don't give me any output, in comparision to for example:
$variable = get-service
$variable.Name
long list of service names
Is function (or functions overall) designed in a way, that this method is impossible to use?
I plan to sum them by using more less the method I used in this script Powershell: System.Object[] in export-csv file
What I want to achieve is to sum Used column for first 8 disks (there are 20 of them on VM), export an output as csv and send an html email based on that csv file.
$variable = Get-Diskfree;$variable.Usedworked for meGet-Diskfree, use$variable = Get-Diskfree | Select-Object -First 8. To get the sum of theUsedcolumn, this should do it:$totalUsed = $variable | Measure-Object Used -sum | Select-Object -ExpandProperty Sum