"jasper" <sd**********@a s9df7as9df7.com > wrote
i am trying to make a very simple program that will just detect
and output your currently connected IDE devices. It will look
something like this:
IDE PRIMARY MASTER:
IDE PRIMARY SLAVE:
IDE SECONDARY MASTER:
IDE SECONDARY SLAVE:
And it will just show you what you have connected.
I have been researching for hours and hours for how to
do this and I've come up with NOTHING!
Is this even possible?
This should get you started. It may have more than you wanted
to know about your drives, but it was basically a copy and paste
from a scripting resource. Take note of the ExecQuery, as it is
'similar' to SQL (a _small_ subset, to say the least) so that you can
tailor the query to return just the properties you want, or include
a WHERE clause to return just those whose InterfaceType is IDE,
etc....
Paste the code below into a Form, add a button and remove
Option Explicit, if present. (Not advised, but for the demo....)
For further studies, locate tutorials on WMI scripting.
LFS
Private Sub Command1_Click( )
strComputer = "."
Set objWMIService = GetObject("winm gmts:" _
& "{impersonation Level=impersona te}!\\" & strComputer & "\root\cimv 2")
Set colDiskDrives = objWMIService.E xecQuery _
("SELECT * FROM Win32_DiskDrive ")
For Each objDiskDrive In colDiskDrives
Debug.Print vbCrLf
' Might these be what you want?
Debug.Print "Caption: " & objDiskDrive.Ca ption
Debug.Print "Interface Type: " & objDiskDrive.In terfaceType
Debug.Print "Device ID: " & objDiskDrive.De viceID
Debug.Print "Bytes Per Sector: " & _
objDiskDrive.By tesPerSector
For Each strCapability In objDiskDrive.Ca pabilities
Debug.Print "Capabiliti es: " & strCapability
Next
Debug.Print "Index: " & objDiskDrive.In dex
Debug.Print "Manufactur er: " & objDiskDrive.Ma nufacturer
Debug.Print "Media Loaded: " & objDiskDrive.Me diaLoaded
Debug.Print "Media Type: " & objDiskDrive.Me diaType
Debug.Print "Model: " & objDiskDrive.Mo del
Debug.Print "Name: " & objDiskDrive.Na me
Debug.Print "Partitions : " & objDiskDrive.Pa rtitions
Debug.Print "PNP DeviceID: " & objDiskDrive.PN PDeviceID
Debug.Print "SCSI Bus: " & objDiskDrive.SC SIBus
Debug.Print "SCSI Logical Unit: " & _
objDiskDrive.SC SILogicalUnit
Debug.Print "SCSI Port: " & objDiskDrive.SC SIPort
Debug.Print "SCSI TargetId: " & objDiskDrive.SC SITargetId
Debug.Print "Sectors Per Track: " & _
objDiskDrive.Se ctorsPerTrack
Debug.Print "Size: " & objDiskDrive.Si ze
Debug.Print "Status: " & objDiskDrive.St atus
Debug.Print "Total Cylinders: " & _
objDiskDrive.To talCylinders
Debug.Print "Total Heads: " & objDiskDrive.To talHeads
Debug.Print "Total Sectors: " & objDiskDrive.To talSectors
Debug.Print "Total Tracks: " & objDiskDrive.To talTracks
Debug.Print "Tracks Per Cylinder: " & _
objDiskDrive.Tr acksPerCylinder
Next
End Sub
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----