Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Syntax for rounding to two decimal places

$
0
0

Here’s the code:

$diskprops = @{'Volume'=$disk.DeviceID; 'Size'=$disk.Size/1gb; 'Used'=($disk.Size - $disk.FreeSpace)/1gb; 'Available'=$disk.FreeSpace/1gb; 'FileSystem'=$disk.FileSystem; 'Type'=$disk.Description 'Computer'=$disk.SystemName;} 

This is nested inside a function I’m building to query Vm Guest Disk space on a specific server. I only want to display two decimal places for Size, Used and Available. I want to use this: [math]::Round($,2) but I can’t figure out how to properly pass the value of the line to that designated variable inside the parentheses. Any help would be appreciated.

submitted by /u/Moviefreak4702
[link] [comments]

The post Syntax for rounding to two decimal places appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles