Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Need help with multiple filters with Get-ADUser

$
0
0

I have created this script and it works great.

Get-ADUser -SearchBase "OU=Accounts,OU=toplevel,DC=mydomain,DC=edu” -Filter 'enabled -eq $true' -Properties * | Select-Object -Property SamAccountName, DisplayName,GivenName,OtherName,Surname,EmailAddress,Title,Department,OfficePhone,Fax,MobilePhone | Sort-Object -Property Name | ConvertTo-CSV > c:\users\shelby\desktop\output.csv -notypeinformation

I need to add to the following script a filter that looks for mail=*xyz.org or mail=*xyz.com or mail=xyz.edu and if any of those email addresses exist then send output to the csv file. Can anyone give me an example on how to do this? I am really confused on how to setup multiple filters.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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