Question:
Is this possible?
My first guess would be something like:
C:> Get-WmiObject Win32_CDROMDrive
But when I tried this, it only tells me Caption
, Drive
, Manufacturer
,VolumeName
No information on whether or not there is a CD in the disc drive.
Answer:
You can get this information by
1 2 |
(Get-WMIObject -Class Win32_CDROMDrive -Property *).MediaLoaded |
You can see what properties are available for that WMI class by
1 2 |
Get-WMIObject -Class Win32_CDROMDrive -Property * | Get-Member |
and more detailed documentation from
1 2 |
Get-WMIHelp -Class Win32_CDROMDrive |
In general, you will find that liberal use of the Get-Help
, Get-Member
, Get-Command
, and Get-WMIHelp
cmdlets will provide you with a great deal of information, and possibly eliminate the need to ask questions like this here and wait for an answer that may or may not come.