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?
 
Ben Personick (Previously QCubed)Connect With a Mentor 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
 
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
Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

 
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
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.