Link to home
Start Free TrialLog in
Avatar of CraigMan
CraigManFlag for United States of America

asked on

Powershell - Sort results alphabetically

I'm new to powershell, and am looking for a way to modify a line of script so the output will be in alphabetical order. Currently, the output appears as a column of users in no order. I would prefer to see the ouput arranged alphabetically. Here is the script code in question.

Get-User -DomainController $SrcDC.SelectedItem -Credential $Remote |
Where-Object {$_.RecipientType -match "UserMailbox"}|
ForEach-Object {$SrcMx.Items.Add($_.Name)}
Avatar of Akhater
Akhater
Flag of Lebanon image

ASKER CERTIFIED SOLUTION
Avatar of GusGallows
GusGallows
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
nice restructuring
Avatar of CraigMan

ASKER

Perfect solution!

Thanks Gus. I didn't need to do anything. Just cut and pasted to replace my code.

Thanks again