{"id":71403,"date":"2004-09-20T15:39:00","date_gmt":"2004-09-20T15:39:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2004\/09\/20\/how-can-i-tell-if-a-computer-has-a-dvd-drive-installed\/"},"modified":"2004-09-20T15:39:00","modified_gmt":"2004-09-20T15:39:00","slug":"how-can-i-tell-if-a-computer-has-a-dvd-drive-installed","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-tell-if-a-computer-has-a-dvd-drive-installed\/","title":{"rendered":"How Can I Tell if a Computer Has a DVD Drive Installed?"},"content":{"rendered":"<p><img decoding=\"async\" class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"><\/p>\n<p>Hey, Scripting Guy! How can I tell if a computer has a DVD drive installed?<\/p>\n<p>&#8212; GC<\/p>\n<p><img decoding=\"async\" border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><img decoding=\"async\" class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><a href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><img decoding=\"async\" class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/a><\/p>\n<p>Hey, GC. No doubt you\u2019re hoping we\u2019ll say something like, \u201cWhy, you just use the Win32_DVD class, of course.\u201d Unfortunately, though, we can\u2019t say that; that\u2019s because there <i>is<\/i> no Win32_DVD class, or any class devoted to DVD drives. There is, of course, the Win32_CDROMDrive class, but it doesn\u2019t have any properties like, say, DVDDrive. Looks bleak, doesn\u2019t it?<\/p>\n<p>But don\u2019t worry, it &#8211; well, OK, in some cases it <i>is<\/i> bleak. But in other cases there is a workaround. If you have a DVD drive, the acronym DVD will often appear in the Caption property of the Win32_CDROMDrive class. For example, the Caption property might have a value similar to this:<\/p>\n<pre class=\"codeSample\">QSI CDRW\/DVD SBW242U\n<\/pre>\n<p>See the letters DVD? That indicates that this is a DVD drive. Like we said, not 100% foolproof, but most DVD drives will include the letters DVD in the Caption property.<\/p>\n<p>You might also note the letters CDRW in the caption. As you might guess, those letters stand for CD Read\/Write; turns out this particular drive not only can play DVDs, it can also read and write CDs. This is another question we get asked quite a bit: how can you tell whether or not a CD drive can <i>write<\/i> CDs? Checking for the letters RW within the Caption property is probably your best bet for that as well. Supposedly this can also be done by checking for the value 4 in the Capabilities property, but, to be honest, we have yet to see the value 4 returned from a drive capable of writing CDs. You\u2019re better off using the Caption property.<\/p>\n<p>Oh, yeah; we almost forgot. Here\u2019s a sample script that returns the drive letter and caption for all the CD\/DVD drives installed on a computer:<\/p>\n<pre class=\"codeSample\">strComputer = \".\"\nSet objWMIService = GetObject(\"winmgmts:\\\\\" &amp; strComputer &amp; \"\\root\\cimv2\")\nSet colItems = objWMIService.ExecQuery(\"Select * from Win32_CDROMDrive\")\nFor Each objItem in colItems\n    Wscript.Echo \"Drive Letter: \" &amp; objItem.Drive\n    Wscript.Echo \"Caption: \" &amp; objItem.Caption\nNext\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I tell if a computer has a DVD drive installed? &#8212; GC Hey, GC. No doubt you\u2019re hoping we\u2019ll say something like, \u201cWhy, you just use the Win32_DVD class, of course.\u201d Unfortunately, though, we can\u2019t say that; that\u2019s because there is no Win32_DVD class, or any class devoted to DVD [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[34,35,3,5],"class_list":["post-71403","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-hardware","tag-peripherals-and-devices","tag-scripting-guy","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I tell if a computer has a DVD drive installed? &#8212; GC Hey, GC. No doubt you\u2019re hoping we\u2019ll say something like, \u201cWhy, you just use the Win32_DVD class, of course.\u201d Unfortunately, though, we can\u2019t say that; that\u2019s because there is no Win32_DVD class, or any class devoted to DVD [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/71403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=71403"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/71403\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=71403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=71403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=71403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}