Hi, All.
This is, I feel, an easy one for most. I can’t seem to wrap my head around how to do it though.
I’m getting the disk partitions from a remote system using the following:
invoke-command -ComputerName "Server1" -ScriptBlock{get-partition | Select DriveLetter, diskNumber, AccessPaths | FT -Auto}
The “AccessPaths” needs to be expanded, then split or trimmed, so I can get the drive labels. If I just have the info (run from the CMD above) I get:
DriveLetter diskNumber AccessPaths
----------- ---------- -----------
0 {\\?\Volume{da6802b2-0000-0000-0000-100000000000}\}
C 0 {C:\, \\?\Volume{da6702b2-0000-0000-0000-501600000000}\}
0 {\\?\Volume{da6702b2-0000-0000-0000-c0db23000000}\}
1
E 1 {E:\, \\?\Volume{4ffea9a0-a11f-4296-a52b-225beaf57b83}\}
2
L 2 {L:\, \\?\Volume{62216345-cd70-4717-8ad3-b267856b034a}\}
3
P 3 {P:\, \\?\Volume{8491eec4-acdb-416d-881e-32a0e0c11ede}\}
4
U 4 {U:\, \\?\Volume{64fe0a79-aa52-4ed0-b5ef-a934b4eb9954}\}
5
Z 5 {Z:\, \\?\Volume{974dcfae-686f-48af-b3d0-4fc60c2b149d}\}
6 {Z:\Test01\, \\?\Volume{7553a6a6-0000-0000-0000-010000000000}\}
What I’m hoping to get is output that captures all drives and mounted drives (disks mounted to a folder). That looks something like the follow:
DriveLetter diskNumber Label
--------------- ---------------- -------
C 0 C:\
E 1 E:\
L 2 L:\
P 3 P:\
U 4 U:\
Z 5 Z:\
6 Z:\Test01\
Again, I’m sure this is easy, but I can’t wrap my head around how this would be done.
Thanks!