The most common DataTypes used in PowerShell are listed below
[string] Fixed-length string of Unicode characters [char] A Unicode 16-bit character [byte] An 8-bit unsigned character [int] 32-bit signed integer [long] 64-bit signed integer [bool] Boolean True/False value [decimal] A 128-bit decimal value [single] Single-precision 32-bit floating point number [double] Double-precision 64-bit floating point number [DateTime] Date and Time [xml] Xml object [array] An array of values [hashtable] Hashtable object
Powershell has two built in variables $true and $false for displaying the true and false boolean values.
There is also [void] casting an expression to the void datatype will effectively discard it (like redirecting to $null)
To force a conversion to a specific datatype, prefix the value or variable with the type in square brackets:
PS C:\> [int]"0064"
PS C:\> [int]$false
To test the datatype of a value use a comparison operator:
PS C:\> 32 -is [int] -> true PS C:\> $true -is [bool] -> true
In addition to the above, if you are using other .NET classes then you can use those datatypes too.
“Character is what we do when no one's looking” - Bill Hybels
Related:
Get-Item Variable:
Get-Variable