• There are some extra returns in the code in the article. Try this instead (notice the line breaks are different):

    param ( [string]$ComputerName = "." )

    Get-WmiObject -computername "$ComputerName" Win32_LogicalDisk -filter "DriveType=3" |

    foreach { add-member -in $_ -membertype noteproperty UsageDT $((Get-Date).ToString("yyyy-MM-dd"))

    add-member -in $_ -membertype noteproperty SizeGB $([math]::round(($_.Size/1GB),2))

    add-member -in $_ -membertype noteproperty FreeGB $([math]::round(($_.FreeSpace/1GB),2))

    add-member -in $_ -membertype noteproperty PercentFree $([math]::round((([float]$_.FreeSpace/[float]$_.Size) * 100),2)) -passThru } |

    Select UsageDT, SystemName, DeviceID, VolumeName, SizeGB, FreeGB, PercentFree