title: Disk Space Check in Powershell
body: <p>I am currently checking disk space size using power shell but was wondering how I can amend the below to add a percentage of space left?    </p>
  
  <pre><code>Format-Table DeviceId, MediaType, @{n="Size";e={[math]::Round($_.Size/1MB,2)}},@{n="FreeSpace";e={[math]::Round($_.FreeSpace/1MB,2)}}
  </code></pre>
  
  <p>I have tried to do it by changing the math but no luck.</p>
  
  <pre><code>gwmi win32_logicaldisk  -Computername PCNAME| Format-Table DeviceId, MediaType, @{n="Size";e={[math]::Round($_.Size/1MB,2)}},@{n="FreeSpace" (%);e={[math]::Round($_.FreeSpace/$_.Size*100,2)}}|Out-File c:\PMC\Disk\OutPut\Newcastle.txt
  </code></pre>
  
  <p>This just returns an error.</p>