I want to lost down all users whose email addresses begins with sh followed by any other 6 characters.


How can I achieve that using active directory users and computers or Get-ADUser or some other means?



So you are looking for mail addresses with a fixed length of 16 characters (Sh******@abc.com). Starting with sh is covered by Powershells like operator. This should work:

Get-ADUser -Filter {EMailAddress -like "sh*"} -Properties EmailAddress| Where {$_.EMailAddress.length -eq 16}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.