22 May 2016

How do I - Round numbers to a given decimal space in Powershell?

One of my subscribers asked how to round in Powershell.  It's actually quite easy.  All you have to do is use the [math] preprocessor's Round() method e.g. if I wanted to round to two decimal places I'll use the following:

[math]::Round($value, 2);

If I issue the Round() call without a second parameter thus:

[math]::Round($value);

I would get an integer rounded value, i.e. I'd get the whole, ignoring any decimals.

Hope that helps!

Later
C

SharePoint Remote Event Receivers are DEAD!!!

 Well, the time has finally come.  It was evident when Microsoft started pushing everyone to WebHooks, but this FAQ and related announcement...