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\Accounting                 33421165568
E:\Resources\Groups\Arboretum                  63962508288
E:\Resources\Groups\Biometrics                  1689715712
Robert LoganNetwork AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ben Personick (Previously QCubed)Lead Network EngineerCommented:
You can do it in-line this way:

Get-FsrmQuota | Select-Object Path, @{"Name"="Usage (GB)"; "Expression"=$([math]::Round(($_.Usage / 1GB),2))} | Sort-Object Path

Open in new window

0
Robert LoganNetwork AdministratorAuthor Commented:
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.Automation.ScriptBlock}.
At line:1 char:17
+ ... FsrmQuota | Select-Object Path, @{"Name"="Usage (GB)"; "Expression"=$ ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Select-Object], NotSupportedException
    + FullyQualifiedErrorId : DictionaryKeyIllegalValue1,Microsoft.PowerShell.Commands.SelectObjectCommand
0
Sajen JoseCommented:
Maybe adding this might help ".ToString()" as shown below:

Get-FsrmQuota | Select-Object Path, @{"Name"="Usage (GB)"; "Expression"=$([math]::Round(($_.Usage / 1GB),2)).ToString()} | Sort-Object Path
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Ben Personick (Previously QCubed)Lead Network EngineerCommented:
Hmm, Try this alternative version, starting with the most stripped down version:

Most Stripped down (no Rounding):
Get-FsrmQuota | Select Path, @{Expression={$_.Usage / 1GB;Label="Usage_GB"} | Sort-Object Path

Open in new window


Alternate rounding version:
Get-FsrmQuota | Select Path, @{Expression={$([math]::Round(($_.Usage / 1GB),2));Label="Usage_GB"} | Sort-Object Path

Open in new window

0
Robert LoganNetwork AdministratorAuthor Commented:
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]::Round(($_.Usage / 1GB),2)).ToString
>>
0
Robert LoganNetwork AdministratorAuthor Commented:
Sajen -- My mistake.  Your code generates a Path list but doesn't generate Usage (GB):

Path                                          Usage (GB)
----                                          ----------
E:\Resources\Groups\Accounting
E:\Resources\Groups\Applied Forest Management
E:\Resources\Groups\Arboretum
E:\Resources\Groups\AvianScienceCenter
E:\Resources\Groups\BandyRanch
E:\Resources\Groups\Biometrics
0
Robert LoganNetwork AdministratorAuthor Commented:
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]::Round(($_.Usage / 1GB),2));Label="Usage_GB"} | Sort-Object Path
>>
0
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
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?
0
Robert LoganNetwork AdministratorAuthor Commented:
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  1944
0
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
Found a problem with my examples, I can't use FSRM quote for testing, and I think the example I used was WMIC, but likely the issue is simply I missed some curlies, and needed to use the name instead of the label (label seems to work for WMIC, but not everything, name seems to be more universal.)

Get-FsrmQuota | Select Path, @{ Name="Usage_GB";Expression={$([math]::Round(($_.Usage / 1GB),2))}} | Sort-Object Path

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert LoganNetwork AdministratorAuthor Commented:
Ben,
Nailed it.  Thank you so much!

Robert
1
Robert LoganNetwork AdministratorAuthor Commented:
Ben,
Nailed it.  Thank you so much!

Robert
1
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
Glad to help! :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.