Link to home
Start Free TrialLog in
Avatar of PeterHing
PeterHingFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Exchange Powershell Query

Hi All,

I'm just trying to run a basic query in Exchange Powershell to obtain and export all SAMAccountName and DisplayName. I have been trying to use the code below, but I just get a file with what appears to be SIDs.

Get-Mailbox | Sort SAMAccountName,DisplayName | Format-Table SAMAccountName,DisplayName | Export-Csv C:\List.csv

Open in new window


Can someone let me know what I should be running?

Many thanks,

Pete
ASKER CERTIFIED SOLUTION
Avatar of Manpreet SIngh Khatra
Manpreet SIngh Khatra
Flag of India 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
Get-Mailbox | Sort-Object -Property Name  | Format-Table SAMAccountName, Name | Export-Csv C:\List.csv
Instead of using Format-Table use select-item, it should be fine.

Get-Mailbox | Sort SAMAccountName| select SAMAccountName,DisplayName | Export-Csv C:\List.csv

Open in new window