Are you having challenges with the Get-ADUser commandlet not pitching errors on a -Filter producing $null results? Intuitively, it would make sense for the -Filter to filter those out with a -ne $null. Well, it doesn’t work that way. There is a Where-Object commandlet that one can pipe to and filter out those things. In my example, I chose to filter out $null User Principal Names. Here’s the example:
$myNonNullUsers = Get-ADUser -Filter { enabled -eq $true } -Properties * | Where-Object {$_.userPrincipalName -ne $null}