Windows Server 2016-ps filter export user mailbox property contains a field list


In the production environment, we often encounter the situation of ending with multiple mailbox aliases. How to quickly export the user list information of the current domain user mailbox ending with a certain field or suffix becomes particularly important. In this example, how to quickly filter out the user list of the current mailbox information including through PowerShell and export it under the simple summary.

Examples are as follows:

Get-ADUser -Filter * -SearchBase “OU=syncall,DC=azureyun,DC=com” -Properties name,mail |Where-Object {$_.mail -match “”} |Export-Csv c:\azureyun_mail.csv -Encoding utf8 -NoTypeInformation

At the same time, we can quickly get the number of users whose current email contains information:

(Get-ADUser -Filter * -SearchBase “OU=syncall,DC=azureyun,DC=com” -Properties name,mail |Where-Object {$_.mail -match “”} ).count

Welcome to WeChat public: Xiao Wen Xi she.