3

I am trying to get all drive letters of a Windows system with Powershell, but I cannot figure it out. Any Ideas?

I have tried to use Get-Volume, but it has no parameter for -ByDriveType or -ByType or -Type or anything.

Saggex
  • 3,390
  • 3
  • 22
  • 37
  • This may be useful: http://superuser.com/questions/787613/viewing-all-accessible-drives-in-powershell – xmojmr Oct 27 '16 at 08:01

2 Answers2

7

If you only want the optical drives (as mentioned in your title), use this:

Get-CimInstance Win32_LogicalDisk | ?{ $_.DriveType -eq 5} | select DeviceID
David Brabant
  • 41,623
  • 16
  • 83
  • 111
-1

Try this instead:

gdr -PSProvider 'FileSystem'

gdr is an alias for Get-PSDrive

Kyll
  • 7,036
  • 7
  • 41
  • 64