Technical Articles
F5 SMEs share good practice.
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

0151T000003d4YwQAI.jpg Welcome to this addition of the PowerShell ABC's where you'll find 26 posts detailing a component of the PowerShell scripting language, one letter at a time.  Today's letter is the letter "N" and for this letter I'm going to discuss one of the core types of objects you'll likely be dealing with: Numbers.

PowerShell supports all of the basic .NET numeric types and performs conversions to and from the different types as needed.  The types, along with the PowerShell type names are in the following table

.NET Full Type Name |PowerShell Short Type Name |Example


Default Type Determiniation

0151T000003d4YxQAI.jpg If you don't specify a type for a literal, the system will figure out the best type and way to represent the number. 

Integers (System.Int32) will be used by default and if the literal value is too large to fit into a 32-bit integer, then a long 64-bit integer (System.Int64) will be used.  If it's too large for a 64 bit integer, or if it contains a decimal point, then a double (System.Double) will be used. 

The System.Single type is supported but is typically not used as it provides no advantages over the System.Double type.

There is one condition where you will want to specify the type and that would be for the decimal type (System.Decimal).  This is done by placing a "d" after the number with no whitespace in between.

Multiplier Suffixes

The PowerShell team was kind enough to add some special suffixes for numbers to make managing larger numbers easier.  The following table lists the special powers of two modifiers supported by PowerShell

Multiplier Suffix |Multiplication Factor |Example |Equivalent Value |.NET Type


*Note, that tb (terabyte) and pb (petabyte) were added in PowerShell v2.

Don't forget the hexidecimals

The last type of number literals are hexidecimals.  Hexidecimal numbers are in base-16 and thus use the 16 distinct symbols [0-9] and [A-F] to represent the values 0-15 respectively.  PowerShell follows the same notation as C, C++, C#, and many other languages in that you prefix the number with the sequence Zero-X ("0x") and allowing the letters A-F (in either case) as extra digits. 0x10 -> 16, 0xF -> 16, and so on.

Version history
Last update:
‎08-Jan-2009 07:03
Updated by: