Robert Logan
asked on
How do I display the output of Get-FsrmQuota in GB rather than Kb?
RE: Windows Server: File Server Resource Manager.
Is it possible to display the results of Get-FsrmQuota in GB rather than Kb?
Here's the code I run in PowerShell -
Get-FsrmQuota | Select-Object Path, Usage | Sort-Object Path
Here's the result:
Path Usage
---- -----
E:\Resources\Groups\Accoun ting 33421165568
E:\Resources\Groups\Arbore tum 63962508288
E:\Resources\Groups\Biomet rics 1689715712
Is it possible to display the results of Get-FsrmQuota in GB rather than Kb?
Here's the code I run in PowerShell -
Get-FsrmQuota | Select-Object Path, Usage | Sort-Object Path
Here's the result:
Path Usage
---- -----
E:\Resources\Groups\Accoun
E:\Resources\Groups\Arbore
E:\Resources\Groups\Biomet
ASKER
Thanks for replying. I'm headed out for the weekend but when I tried that command in a PS window, I got the following error. (I'll be back Monday.)
Select-Object : The "Expression" key has a type, System.Decimal, that is not valid; expected types are {System.String,
System.Management.Automati on.ScriptB lock}.
At line:1 char:17
+ ... FsrmQuota | Select-Object Path, @{"Name"="Usage (GB)"; "Expression"=$ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidArgument: (:) [Select-Object], NotSupportedException
+ FullyQualifiedErrorId : DictionaryKeyIllegalValue1 ,Microsoft .PowerShel l.Commands .SelectObj ectCommand
Select-Object : The "Expression" key has a type, System.Decimal, that is not valid; expected types are {System.String,
System.Management.Automati
At line:1 char:17
+ ... FsrmQuota | Select-Object Path, @{"Name"="Usage (GB)"; "Expression"=$ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Select-Object], NotSupportedException
+ FullyQualifiedErrorId : DictionaryKeyIllegalValue1
Maybe adding this might help ".ToString()" as shown below:
Get-FsrmQuota | Select-Object Path, @{"Name"="Usage (GB)"; "Expression"=$([math]::Rou nd(($_.Usa ge / 1GB),2)).ToString()} | Sort-Object Path
Get-FsrmQuota | Select-Object Path, @{"Name"="Usage (GB)"; "Expression"=$([math]::Rou
Hmm, Try this alternative version, starting with the most stripped down version:
Most Stripped down (no Rounding):
Alternate rounding version:
Most Stripped down (no Rounding):
Get-FsrmQuota | Select Path, @{Expression={$_.Usage / 1GB;Label="Usage_GB"} | Sort-Object Path
Alternate rounding version:
Get-FsrmQuota | Select Path, @{Expression={$([math]::Round(($_.Usage / 1GB),2));Label="Usage_GB"} | Sort-Object Path
ASKER
Sajen Jose: When I run your code, it dumps me into a ">>" prompt.
PS C:\Windows\system32> Get-FsrmQuota | Select-Object Path, @{"Name"="Usage (GB)"; "Expression"=$([math]::Rou nd(($_.Usa ge / 1GB),2)).ToString
>>
PS C:\Windows\system32> Get-FsrmQuota | Select-Object Path, @{"Name"="Usage (GB)"; "Expression"=$([math]::Rou
>>
ASKER
Sajen -- My mistake. Your code generates a Path list but doesn't generate Usage (GB):
Path Usage (GB)
---- ----------
E:\Resources\Groups\Accoun ting
E:\Resources\Groups\Applie d Forest Management
E:\Resources\Groups\Arbore tum
E:\Resources\Groups\AvianS cienceCent er
E:\Resources\Groups\BandyR anch
E:\Resources\Groups\Biomet rics
Path Usage (GB)
---- ----------
E:\Resources\Groups\Accoun
E:\Resources\Groups\Applie
E:\Resources\Groups\Arbore
E:\Resources\Groups\AvianS
E:\Resources\Groups\BandyR
E:\Resources\Groups\Biomet
ASKER
Ben Personick --
When I run your either your first or second revision, I get dumped into a ">>" prompt.
PS C:\Windows\system32> Get-FsrmQuota | Select Path, @{Expression={$_.Usage / 1GB;Label="Usage_GB"} | Sort-Object Path
>>
PS C:\Windows\system32> Get-FsrmQuota | Select Path, @{Expression={$([math]::Ro und(($_.Us age / 1GB),2));Label="Usage_GB"} | Sort-Object Path
>>
When I run your either your first or second revision, I get dumped into a ">>" prompt.
PS C:\Windows\system32> Get-FsrmQuota | Select Path, @{Expression={$_.Usage / 1GB;Label="Usage_GB"} | Sort-Object Path
>>
PS C:\Windows\system32> Get-FsrmQuota | Select Path, @{Expression={$([math]::Ro
>>
Sajan's Code is my code with a "To String" which may mean that it's generating a null value response...
What version of Powershell are you running?
What version of Powershell are you running?
ASKER
Major Minor Build Revision
----- ----- ----- --------
5 1 14393 1944
----- ----- ----- --------
5 1 14393 1944
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ben,
Nailed it. Thank you so much!
Robert
Nailed it. Thank you so much!
Robert
ASKER
Ben,
Nailed it. Thank you so much!
Robert
Nailed it. Thank you so much!
Robert
Glad to help! :)
Open in new window