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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why do I keep forgetting that you can sort by a calculated property?