Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Rounding [INT] in PowersHell

$
0
0

I am having trouble displaying only two decimals places when i am running the following code:

$Event.Message = 14.26171875 (This is just to show what the number is) I am splitting to get portion of the output that is needed by me.

Original String:
The database "First Storage Group\FirstDatabase" has 9052 megabytes of free space after online defragmentation has terminated.

*************************************************

([MATH]::Round([Int](($Event.Message).split(" ")[6]) / 1024),2)

*************************************************

When i run this I am getting the following:

[MATH]::Round 14.26171875 2

I am looking to have an output as such:
14.26

Any Help would be appreciated.


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>