Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

get index of installed hard drives and output in sorted list

$
0
0

Hi there

 

this is my first post here because i cant find anywhere else an solution.

I have to configure fresh server. Therefore i have to identify the installed drives and format the first one.

Now i´m using batch for getting the disk index. Then i have to remove the Word "index" from output and sort the drives. This looks like this:

wmic /output:index.txt Diskdrive where MediaType="Fixed Hard disk media" get index

more +1 index.txt > index.tmp

sort index.tmp > index.txt

 

I can get the Index using ps

gwmi win32_diskdrive | select index

but how can i format the output so i get only the digits in ascending order?

 

thx

netlord


Viewing all articles
Browse latest Browse all 6937

Trending Articles