I'm using the below to target only relevant users with all the specified conditions.
$TargetUsers = Get-ADUser -Filter * -SearchBase $TargetOU -Properties * | Where-Object {$_.adminDescription -eq "Azure_Sync" -and $_.proxyAddresses -notlike "sip*" -and $_.sn -ne $null -and $_."msRTCSIP-PrimaryUserAddress" -ne $null} | Select userPrincipalName, msRTCSIP-PrimaryUserAddress | Sort userPrincipalName
I was pretty sure this was returning all relevant information, however, it seems that this returns users that do have a sip value in the proxyAddresses attribute.
I'm guessing that this is because this is a multi-value attribute? Any ideas what syntax I need to use to address this?