SOLVED

Powershell command to extract UPN and primary SMTP from a set of Display name in csv file.

%3CLINGO-SUB%20id%3D%22lingo-sub-2173356%22%20slang%3D%22en-US%22%3EPowershell%20command%20to%20extract%20UPN%20and%20primary%20SMTP%20from%20a%20set%20of%20Display%20name%20in%20csv%20file.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2173356%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20provide%20me%20PowerShell%20command%20to%20extract%20UPN%20and%20primary%20SMTP%20from%20a%20set%20of%20Display%20name%20in%20csv%20file.%20(office%20365)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2173356%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%20Admin%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2173672%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20command%20to%20extract%20UPN%20and%20primary%20SMTP%20from%20a%20set%20of%20Display%20name%20in%20csv%20file.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2173672%22%20slang%3D%22en-US%22%3EThis%20is%20a%20quick%20example%20on%20how%20to%20get%20the%20user%20information%20from%20a%20displayname%3CBR%20%2F%3E%3CBR%20%2F%3EGet-MsolUser%20-SearchString%20'UserDisplayName'%20%7C%20select%20UserPrincipalName%2CProxyAddresses%3C%2FLINGO-BODY%3E
New Contributor

Hello All,

 

Please provide me PowerShell command to extract UPN and primary SMTP from a set of Display name in csv file. (office 365)

2 Replies
best response confirmed by Azhar_pasha (New Contributor)
Solution
This is a quick example on how to get the user information from a displayname

Get-MsolUser -SearchString 'UserDisplayName' | select UserPrincipalName,ProxyAddresses

Hi @farismalaeb ,

 

Thanks for the below command, However, I was trying on exchange online shell. Hit with an idea to use like this.

 

Import-Csv "csv path" | foreach{Get-Mailbox -Identity $_.displaynames} | select *UserPrincipalName*, *PrimarySmtpAddress* | Export-Csv "export path"