Home/PowerShell/Power Shell – Type comparison

Power Shell – Type comparison

What is comparison Operator?

Comparison operators let you specify conditions for comparing values and finding values that match specified patterns. To use a comparison operator, specify the values that you want to compare together with an operator that separates these values.

Type comparison

The type comparison operators (-is and -isnot) are used to determine if an object is a specific type.

Operators  Description
-is Returns true if both object are the same type
-isnot Returns true if the objects are not the same type

-is Operator

Syntax: <object> -is <type reference>



-isnot Operator

Syntax: <object> -is <type reference>




  1. David February 2, 2018 at 3:52 pm

    shouldn’t this return true? But I get false

    “dfklj”.gettype() -is “lsdkjf”.gettype()

  2. Thiyagu February 4, 2018 at 10:29 am

    Hi David,

    The left hand side value always be an object (-is of a type). please find the below syntax.

Leave A Comment