PowerShell: Check Type

By Xah Lee. Date: . Last updated: .

💡 TIP: Operator names are case-insensitive.

value -is type

test if a value is a given type.

🛑 WARNING: the value to be tested must be on the left-hand-side.

3 -is [int]
# True

3.4 -is [double]
# True

"abc" -is [string]
# True

3,4 -is [Array]
# True
(3).GetType().FullName
# System.Int32

"abc".GetType().FullName
# System.String
value -isnot type

negation of -is

PowerShell. Object and Type

PowerShell. Boolean Related