title: Get Disk info and Convert to GB
body: <p>I have been working on this script to capture disk sizes, however I have them in bytes and they're messy, I have looked at several ways to add a decimal point, but I'm having trouble converting to GB first, Also alongside disk sizes I am trying to calculate free disk size and percentage used.</p>
  
  <pre><code>$servers = (Get-AdComputer -Filter "name -like MY-VM-*'").Name | Sort-Object
  
  foreach ($Server in $Servers)
  {
  $disks= get-wmiobject -ComputerName $Server Win32_volume | select-object pscomputername, Capacity, driveletter, freespace |`
   format-table | out-file c:\temp\new3.txt -append
  
  Foreach ($disk in $disks)
  {
    $driveletter = $disk.driveletter
    $totalsize = $disk.capacity
    $freespace = $disk.freespace
    $freespace = [math]::round($freespace[$_] /9.3132257461548)
    $Percent_Free = [math]::round(($freespace / $totalsize ) * 100)
     }  
  }
  </code></pre>
  
  <p>Hope that makes sense :)</p>