Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all devices, partitions and volumes in Powershell

I have multiple volumes (as nearly everybody nowadays): on Windows they end up specified as C:, D: and so on. How do I list these all like on a Unix machine with "ls /mnt/" with Powershell?

like image 536
wishi Avatar asked Nov 02 '09 20:11

wishi


People also ask

How do I list all drives in PowerShell?

For a list of the Windows PowerShell drives in your Windows PowerShell session, use the Get-PSDrive cmdlet. Although the drives in the display vary with the drives on your system, the listing will look similar to the output of the Get-PSDrive command shown above.

How do I list a device in PowerShell?

You can do Invoke-Command -ComputerName hostname { Get-WmiObject Win32_PNPEntity | Select Name, DeviceID } to get a device list for a remote computer.


1 Answers

To get all of the file system drives, you can use the following command:

gdr -PSProvider 'FileSystem' 

gdr is an alias for Get-PSDrive, which includes all of the "virtual drives" for the registry, etc.

like image 179
bdukes Avatar answered Oct 10 '22 22:10

bdukes