Strictly speaking, you're looking for a semantics checker, given that your code is syntactically correct.
The problem here is that while the code was formally correct, it doesn't do what you intended it to do.
PSScriptAnalyzer (PSSA) is a linter for PowerShell, and it is integrated into the PowerShell extension for Visual Studio Code.
It would catch your problem, emitting the following message:
Did you mean to use the redirection operator '>'?
The comparison operators in PowerShell are '-gt' (greater than) or '-ge' (greater or equal).
Use in Visual Studio Code:
Install the PowerShell extension.
Once installed, with your script opened for editing, you'll see the > 0 part underlined, and hovering over it shows the message as a tooltip.
You can see all messages for the current file in the Problems view (Ctrl-Shift-M or, via the menus, View > Problems), which incidentally, will show you that PSSA found additional potential problems with your code snippet.
To configure what rules to apply (which potential problems to warn about), use >PowerShell: Select PSScriptAnalyzer Rules from the command palette.
Note that PSSA also offers automatic (re)formatting of PowerShell code (Alt-Shift-F or, via the command palette, >Format Document).
Stand-alone use:
With your code, you'd see the following output (having been given a script named pg.ps1):
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSPossibleIncorrectUsageOfRedirecti Warning pg.ps1 1 Did you mean to use the redirection operator '>'? The
onOperator comparison operators in PowerShell are '-gt' (greater than)
or '-ge' (greater or equal).
PSPossibleIncorrectComparisonWithNu Warning pg.ps1 1 $null should be on the left side of equality comparisons.
ll
PSUseDeclaredVarsMoreThanAssignment Warning pg.ps1 2 The variable 'templID' is assigned but never used.
s
PSAvoidUsingWriteHost Warning pg.ps1 3 File 'pg.ps1' uses Write-Host. Avoid using Write-Host
because it might not work in all hosts, does not work when
there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.