I\'m trying to create a new Active Directory user, but first I verify that the user doesn\'t exist already with Get-ADUser.
I import the user data from our HR d
Never use a script block ({ ... }) as the -Filter argument - the -Filter parameter's type is [string] - construct your filter as a string.
While seemingly convenient, using a script block only works in very limited scenarios and causes confusion when it doesn't work - such as when involving property access, as in this case.
For more information, see this answer of mine.