Hello, @Mani,
Welcome to the Microsoft Q&A platform!
To efficiently pull a report of users with specific subdomain aliases, you can use PowerShell. Here's a script that can help you filter out users with the "contoso" subdomain from your 20k users:
1.Open PowerShell with administrative privileges.
2.Run the following script:
# Connect to Exchange Online
Connect-ExchangeOnline -UserPrincipalName ******@domain.com -ShowProgress $true
# Define the subdomain to filter
$subdomain = "contoso"
# Get all users and filter by alias
$users = Get-Mailbox -ResultSize Unlimited | Where-Object {
$_.EmailAddresses -match $subdomain
}
# Export the filtered users to a CSV file
$users | Select-Object DisplayName, PrimarySmtpAddress, EmailAddresses | Export-Csv -Path "C:\Users\YourUsername\Documents\FilteredUsers.csv" -NoTypeInformation
# Disconnect from Exchange Online
Disconnect-ExchangeOnline -Confirm:$false
Test Results:
This script should help you quickly generate the report you need without manually checking each user. Let me know if you need any further assistance!
If the answer is helpful, please click on “Accept answer” as it could help other members of the Microsoft Q&A community who have similar questions and are looking for solutions.
Thank you for your support and understanding.
Best Wishes,
Alex Zhang