Performing calculations is an integral part of automation. Of course, PowerShell allows for it. PowerShell also takes things up a level by providing administrators with what is called administrative constants, which help ease calculations (which will be addressed in the following recipes). We will first look at common arithmetic operations, and then move toward using the concepts on outputs using calculated properties, as we saw in Chapter 4, Passing Data through the Pipeline.
We will also look at cases where we could ease automation using binary numbers to identify flags, perform base conversion, and, finally, use some of the .NET accelerators or cast operators to simplify scripting.