Quantcast
Channel: Using and/or operators in powershell command - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Using and/or operators in powershell command

$
0
0

I want this query to only return enabled users who have a name matching "marketing" or "accounting". However, when I run this it's returning disabled users as well? What am I missing? From my research this is what I came up with but it's not working.

Get-ADuser -filter {(Name -like "*marketing*") -or (Name -like "*accounting*") -and (Enabled -eq "true")} -Properties *

Thanks for any advice!


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>