Search code examples
windowspowershelloperating-systemdisk

Powershell Get all Optical Drive Letters


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.


Solution

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

    Get-CimInstance Win32_LogicalDisk | ?{ $_.DriveType -eq 5} | select DeviceID