$Shares = Get-WMIObject Win32_Share -ComputerName localhost
$Volumes = Get-WMIObject Win32_Volume -ComputerName localhost
Foreach ($Share in $Shares) 
{ 
   If ($Share.Type -eq 0)
   { 
      $Result = "" | Select Server, Share, Path, Volume, Used, Free, Total
      $Result.Server=$Share.__SERVER
      $Result.Share=$Share.Name
      $Result.Path=$Share.Path
      $ShareVolume="" | Select Name 
      Foreach ($Volume in $Volumes) 
      { 
         If ( ($Result.Path.Length -ge $Volume.Name.Length) -and ($Volume.Name.Length -gt $ShareVolume.Name.Length) )
         { 
            If ($Result.Path.Substring(0,$Volume.Name.Length) -eq $Volume.Name) { $ShareVolume = $Volume } 
          } 
      }
      $Result.Volume=$ShareVolume.Name; 
      $Result.Total=$ShareVolume.Capacity
      $Result.Free=$ShareVolume.FreeSpace
      $Result.Used=$ShareVolume.Capacity - $ShareVolume.FreeSpace
      $Result
   } 
}