To test a variable’s value, you would always use “-eq” right? You would never use “=”, right? I believe that “=” in PowerShell 4 is always an assignment operator.
In all versions of PowerShell that is the case. You can use “=” in an if statement and it doesn’t generate an error. Instead it will do the assignment and the ‘if’ result will always be $true.
= has always been the assignment operator in PowerShell and
-eq has always been the equality comparison operator
for more information on operators see the following help files