Link to home
Start Free TrialLog in
Avatar of abdull sheriff
abdull sheriff

asked on

Power Shell Script for exchange 2010

i have list of users email address in a csv file and i need to get their database name in the csv file using powershell script
Avatar of FOX
FOX
Flag of United States of America image

Name the header of the .csv file Emailaddress
Open up your Exchange Management Shell and run the below command
Import-Csv 'yourfilelocation\filename.csv' | %{Get-Mailbox $_.Emailaddress | Select DisplayName, Alias, Database} | Export-Csv 'yourfilelocation\filename.csv' -notypeinformation
Avatar of abdull sheriff
abdull sheriff

ASKER

thank you so much fox, i get the output

But when i have a csv file with DisplayName and when i run the below script i get the details of Alias and Database but not the emailaddress, the email address is blank

Import-Csv c:\temp.csv | %{Get-Mailbox $_.DisplayName | Select EmailAddress, Alias, Database} | Export-Csv c:\tempoutput.csv -notypeinformation
ASKER CERTIFIED SOLUTION
Avatar of FOX
FOX
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you so much