• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 829
  • Last Modified:

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
0
PeterHing
Asked:
PeterHing
  • 2
1 Solution
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-Mailbox | SortBy Name | Format-Table SAMAccountName, Name | Export-Csv C:\List.csv

- Rancy
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-Mailbox | Sort-Object -Property Name  | Format-Table SAMAccountName, Name | Export-Csv C:\List.csv
0
 
arsaifCommented:
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

0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now