Powershell - check if the CD is a CD-ROM

Is it possible?

My first guess would be something like:

C:> Get-WmiObject Win32_CDROMDrive

But when I tried it, it only informs me Caption

, Drive

, Manufacturer

,VolumeName

There is no information about the presence of a CD in the drive.

+3


source to share


1 answer


You can get this information

(Get-WMIObject -Class Win32_CDROMDrive -Property *).MediaLoaded

      

You can see what properties are available for this WMI class with

Get-WMIObject -Class Win32_CDROMDrive -Property * | Get-Member

      



and more detailed documentation from

Get-WMIHelp -Class Win32_CDROMDrive

      

In general, you will find that the liberal use of cmdlets Get-Help

, Get-Member

, Get-Command

and Get-WMIHelp

provide you with more information and possibly eliminate the need to ask questions like this here and wait for an answer, which may or may not come.

+3


source







All Articles