Advertisement
About80Ninjas

Format-DiskSize

Jan 8th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function Format-DiskSize() {
  2.     [cmdletbinding()]
  3.     Param ([long]$Type)
  4.     If ($Type -ge 1TB) {[string]::Format('{0:0.00} TB', $Type / 1TB)}
  5.     ElseIf ($Type -ge 1GB) {[string]::Format('{0:0.00} GB', $Type / 1GB)}
  6.     ElseIf ($Type -ge 1MB) {[string]::Format('{0:0.00} MB', $Type / 1MB)}
  7.     ElseIf ($Type -ge 1KB) {[string]::Format('{0:0.00} KB', $Type / 1KB)}
  8.     ElseIf ($Type -gt 0) {[string]::Format('{0:0.00} Bytes', $Type)}
  9.     Else {''}
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement