Advertisement
Guest User

Untitled

a guest
Nov 15th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for($i = 0; $i -lt $drives.Count; $i++) {
  2.         #get the drive letter
  3.         $driveLetter = $drives.DriveLetter[$i]
  4.  
  5.         # calc some bytes
  6.         $freeBytes = $drives.FreeSpace[$i]
  7.         $totalBytes = $drives.Capacity[$i]
  8.         $usedBytes = $totalBytes - $freeBytes
  9.  
  10.         # calc some gigs
  11.         $usedGigs = gigify($usedBytes)
  12.         $totalGigs = gigify($totalBytes)
  13.         $freeGigs = gigify($freeBytes)
  14.  
  15.         if($totalGigs -gt 1) {
  16.            $driveLetter + "\ USED: " + $usedGigs + "/" + $totalGigs + "Gb || " + "{0:N2}" -f (($usedBytes/$totalBytes)*100) + "%"
  17.         }
  18.         else {}
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement