Pls lick the below link to read part1shell
https://redmondmag.com/articles/2015/02/18/math-using-powershell-part-1.aspx
express
OK, so enough of the .NET lesson. I think that the real question is how you can call a .NET class without being a professional developer.less
Remember when I said that it was easy to call a .NET class from PowerShell? I wasn't lying. All you have to do is to enclose the class name in brackets, enter two colons and then enter your mathematical expression. Suppose, for instance, that I wanted to know the square root of 64. The first thing that I would need to do is to specify the class name. It's technically System.Math, but we can just use Math. The class name looks like this: [Math]. Next we type two colons. Hence, any line of code that makes use of the Math class will start out like this:ide
[Math]::ui
It doesn't matter if you are calculating a square root or retrieving the value of PI, [Math]:: will always come before the expression.this
So all you need now is the expression. In this case it's SQRT(64). As such, the line of code looks like this:spa
[Math]::SQRT(64)code
You can see the result in Figure 4.orm
=====================================================================blog
Pls lick the below link to read part2
https://redmondmag.com/articles/2015/02/23/powershell-math-2.aspx
The result list shown in the figure above is essentially a list of the math operators that we can use. For instance, we could use the Round method to round a number. You can see an example of this in Figure 6.
[Click on p_w_picpath for larger view.] Figure 6. You can use the Round method to round a number.
As you can see, the System.Math class makes it possible to go way beyond PowerShell's built-in math capabilities. Learning to use the System.Math class opens the door to creating much more powerful PowerShell scripts.