I have a user’s network login name. From PowerShell and WMI is it possible to get a valid email for that user? Note that the login name is different than the name in the email, so I can’t just combine the login name with the email domain.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The simplest way is to useActive-Directory.
As you are using PowerShell tag and not PowerShell V2.0 you can use ADSI.
You can also use
userPrincipalNameinstead ofsAMAccountNamein the filter, foruserPrincipalNameyou can use user@domain form.Using WMI : If you absolutly want to do it with WMI.
You can use the second solution localy on your server or from a computer inside the domain, but it’s a bit more complicated to authenticate to WMI from outside the domain.
Using PowerShell 2.0