Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 476
Saggex Avatar asked Mar 11 '26 02:03

Saggex


1 Answers

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

Get-CimInstance Win32_LogicalDisk | ?{ $_.DriveType -eq 5} | select DeviceID
like image 98
David Brabant Avatar answered Mar 12 '26 20:03

David Brabant