![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | DriveInfo in GBs and calculate used space in GBs, in Percent Hello I would like DriveInfos in GBs and calculate used space I have: $drives = [System.IO.DriveInfo]::GetDrives() $drives | where {$_.DriveType -eq "Fixed"} | Format-Table Name, TotalFreeSpace, TotalSize -auto Output: Name TotalFreespace TotalSize C:\ 63851022848 72818371072 The new Output Name, Freespace in GBs, TotalSize in GBs, Freespace in %, UsedSpace % Thanks for any help Gregor |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: DriveInfo in GBs and calculate used space in GBs, in Percent Try: $FreeGB = @{label="Free (GB)";expression={"{0:N2}" -f ($_.TotalFreeSpace/1gb)}} $TotalSizeGB = @{label="TotalSize (GB)";expression={"{0:N2}" -f ($_.TotalSize/1gb)}} $PFreespace = @{label="% Free";expression={"{0:P2}" -f ($_.TotalFreeSpace/$_.TotalSize)}} $PUsedSpace = @{label="% UsedSpace";expression={"{0:P2}" -f (($_.TotalSize-$_.TotalFreeSpace)/$_.TotalSize)}} [System.IO.DriveInfo]::GetDrives() | where {$_.DriveType -eq "Fixed"} | ft name,$FreeGB,$TotalSizeGB,$PFreespace,$PUsedSpace -auto ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||
| Guest | Re: DriveInfo in GBs and calculate used space in GBs, in Percent Hello Shay Thanks I have problems with name Error message: The term 'name' is not recognized as a cmdlet, function, operable program Do you have a idea? Thanks Gregor "Shay Levi" <no@xxxxxx> wrote in message news:8766a94418eb48ca224f09def646@xxxxxx
| ||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||
| | #4 (permalink) | ||||||||||||||||||||||||||||||||||||
| Guest | Re: DriveInfo in GBs and calculate used space in GBs, in Percent The last two lines of Shay's script are actually one line, wrapped. Make that one line and you should be good to go. -- Kirk Munro [MVP] Poshoholic http://poshoholic.com "Gregor" <nospam@xxxxxx> wrote in message news:801AC0B9-488C-4144-9A1D-87562DC987DF@xxxxxx
| ||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Calculate sum | Jason1008 | PowerShell | 3 | 06-16-2008 11:50 AM |
| Calculate Printer Page Count Per User | Jeffrey Tadlock | PowerShell | 3 | 07-10-2007 03:34 PM |
| Unable to calculate windows experience index | Craig Cockburn | Vista General | 10 | 04-08-2007 02:06 PM |
| How to use http://servername as the DriveInfo.Root? ...a more basic question | Michael Herman \(Parallelspace/OpenCanal\) | PowerShell | 4 | 04-04-2007 01:49 PM |
| Calculate % of CPU time for every active process | krukinews@gmail.com | PowerShell | 0 | 09-27-2006 05:19 AM |