Working with a ps1 Script Get-Partition and try to sort them alphabetically

Hi, I have been experimenting with powershell scripts. I have this ;

Get-Partition | Where-Object DriveLetter -Match ‘^\w$’ | ForEach-Object {

It can see my drives, but the array is not being outputted in logical order, that is I hope to add something that will work.

This experiment is kind of specific, so I dont really know of it is possible, so the indexes are in alphabetic order.

Any suggestions are welcome.

Welcome to the forum. :wave:t4:

Unfortunately your code is incomplete and you’re not describing what your actual goal is. You may share an example how you’d like your ouptput to look like.

Regardless of that - when you post code please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

(Get-Partition).Where({$_.DriveLetter -match '\w'}) | 
Sort-Object -Property DriveLetter

Sorry to be absent so long.

That was just what I needed.

Awesome - thanks.