I have the following
Import-Module SqlServer
$Analysis_Server = New-Object Microsoft.AnalysisServices.Server
$Analysis_Server.connect("$server")
$estimatedSize = $([math]::Round($($($Analysis_Server.Databases[$cube].EstimatedSize)/1024/1024),2))
this generates for me the size in MB
I would like to enhance this to make it more user friendly readable especially for values that are in the double digit MB
for example, sometimes i get values 50.9 MB
which is good. but some other values are 37091 MB
or 3082.86 MB
, and i'd like values like that to be automatically converted to GB (37.09 GB, 3.08 GB
respectively) if they are in the GB range.
and if there are values that are not in MB range, they should be displayed in KB
i.e. 0.78 MB
should just be 780 KB
how can i accomplish this?