# Active Directory - filter checking for null

**URL:** <https://forums.powershell.org/t/active-directory-filter-checking-for-null/13748>\
**Category:** PowerShell Help\
**Created:** [February 2, 2020, 12:02pm UTC](https://forums.powershell.org/t/active-directory-filter-checking-for-null/13748 "2020-02-02T12:02:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wbfick](https://avatars.discourse-cdn.com/v4/letter/w/ed655f/32.png) [@wbfick](https://forums.powershell.org/u/wbfick)\
**Post date:** [February 2, 2020, 12:02pm UTC](https://forums.powershell.org/t/active-directory-filter-checking-for-null/13748/1 "2020-02-02T12:02:00Z")

</div>

I have some basic questions about the get-aduser -filter options. The filter command seems lack several options for filtering that where-object can perform.

1. I am trying to find a property that has an empty or null value. Why can I not use $null with the filter parameter?
2. Why do I need to put single quotes around a variable when its already in double quotes?

Thanks Bill
```
get-aduser -filter {Surname -notlike "*"} #Correct Results

get-aduser -filter \* | Where-Object {$\_.surname -eq $null} #Correct Results

get-aduser -filter {Surname -eq “$null”} # InCorrect Results Returns nothing

get-aduser -filter {Surname -eq $null} #InCorrect Results Error $null value not defined

get-aduser -filter “Name -eq ‘$null’” #InCorrect #get-aduser : The search filter cannot be recognized
```

```
get-aduser -filter "Name -eq '$varPrinter'" #Doesnt a single quote do the literal value $varPrinter?
```

&nbsp;

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:30pm UTC](https://forums.powershell.org/t/active-directory-filter-checking-for-null/13748/2 "2024-05-16T20:30:43Z")

</div>


