When is -gt 0 NOT -ne $null ?

I ran some code yesterday that used this filter:

Where-Object { $_.delivContLength -ne $null -or $_.submissionContLength -ne $null }

…yet, when I ran today a different filter:

-Filter {(delivContlength -gt 0)-or(submissionContLength -gt 0)}

…it discovered some (much greater than 0) values.

How should these strings be best Filtered for?

0 and $null are not same, can you give lil more detail on against what cmdlet output you ran these fiilters and the difference in output in both.

Sure, I was using Get-ADUser to search for values in the aforementioned attributes

AFAIK both filter works differently here, Where-Objects takes the object once Get-ADUser executes per user where as the built-in Filter does it internally then give the output. What is the difference in output with both the approaches.

It may be new values were added since last night by some other process but I cleared out those two attributes for all users that had them (via -ne $NULL discovery) and then today was alerted by a different Filter that there were others (although not near as many).

I’ll check Monday using both filters and see what’s up in the environment.

I have another Domain to test these 2 filters. Methinks there is a process populating the 2 attributes.

PS C:\> ($UserREQ1).Count
12

PS C:\> ($UserREQ1_filter2).Count
12