Determination of disk types

Tim Golden tim.golden at viacom-outdoor.co.uk
Mon Jan 9 05:02:03 EST 2006


[Mondal]

| Is there a way to determine which drive letter is a FDD, a local disk,
| a CD-ROM/COMBO Drive, or a mapped network drive?
| 
| I wrote a script to identify all the drive letters on my Windows XP
| system. Now I want to determine their type, too.

Initial quick reposnse: look at WMI. Something like
the following could get you going:

WMI info from MS:
http://msdn.microsoft.com/library/en-us/dnanchor/html/anch_wmi.asp
Python module: http://timgolden.me.uk/python/wmi.html

<code>
import wmi

c = wmi.WMI ()
for disk in c.Win32_LogicalDisk ():
  print disk

</code>

You probably want to look at the DriveType and MediaType
attributes, and you may well want to look into other
classes such as Win32_DiskDrive. WMI often involves a
fair bit of poking around to find the info you need.

Fortunately if you can find someone who's answered the
question in some other language, perhaps on the WMI
newsgroups, you can easily translate that into Python.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list