Link to home
Start Free TrialLog in
Avatar of bsohn417
bsohn417

asked on

Powershell: Sort list of computer names in numerical order

Hello, I am trying to sort a list of computer names in order that have the same naming convention but differ only by number.  How do I sort numerically in powershell?  I tried:

Get-ADComputer -Filter {name -like "csn*"} | select  name | sort name but getting the below:

CSN1
CSN10
CSN11
CSN12
CSN13
CSN14
CSN15
CSN16
CSN17
CSN18
CSN19
CSN2
CSN20
CSN21
CSN3
CSN4
CSN5
CSN6
CSN7
CSN8
CSN9
ASKER CERTIFIED SOLUTION
Avatar of Maidine Fouad
Maidine Fouad
Flag of Morocco 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
SOLUTION
Avatar of oBdA
oBdA

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
SOLUTION
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
Avatar of oBdA
oBdA

Why do I keep forgetting that you can sort by a calculated property?