We are using hybrid exchange. we have a user alias list and would like to find the displayname, primarysmtpaddress and output to a file.
Below is the power shell script:
$Users = get-content "D\temp\userlist"
foreach ($u in $ Users)
$L = Get-mailbox $u | select alias,promarysmtpaddress, displayname | format-table -autosize
$L | export-csv =path "D:\temp\outfile.csv"
The export-csv statement is not working and if remove the export-csv statement, the output from the screen comes with the following in every line:
Alias PrimarysmtpAddress Displayname
1) Seeking advise how to export the output to a csv file from the script
2) Eliminate "Alias PrimarysmtpAddress Displayname" in every line