Copy regular expressions to a single click

List of users Active Directory Users with Email address

Regular expressions to track the list of users with an email address from Microsoft Active Directory.

# Windows PowerShell

Get-ADUser -Filter {(mail -ne "null") -and (Enabled -eq "true")} -Properties SamAccountName, Name, DisplayName | Select-Object SamAccountName, Name, DisplayName

Export:
out-gridview -title “Active without mail address” – Output to window
Export-Csv -NoTypeInformation -encoding UTF8 “C:\file.csv” – Output to File