Click to See Complete Forum and Search --> : How can I get the SCSI harddisk serial number?


tempstack
March 17th, 2003, 09:01 PM
Hi:

Now I have a question :
How can I program to get the SCSI harddisk serial number??
I can get the IDE harddisk serial number through create the devive file . But I cannot get the SCSI hard disk

Who can help me to solve this problem???
Thanks a lot.

Best Regards
tempstack

ryoken
March 19th, 2003, 07:05 PM
My coworker and I are trying to do the same thing. If we figure it out before you, we'll let you know. If not, we'll be watching this thread. :)

Mick
March 19th, 2003, 07:47 PM
Any reason why your not using WMI and CIM to get this type of information?

ryoken
March 20th, 2003, 12:58 AM
Well, for one I just came across WMI today as a possibility while searching for info on finding SCSI serial numbers, and haven't found a clear example yet on how to do it that way. The example I found for VB doesn't work:
  set objinst = GetObject("WinMgmts::Win32_LogicalDisk='C:'")
  MsgBox (GetObject "WinMgmts::Win32_LogicalDisk='C:'").VolumeSerialNumber)
VB didn't like it. Changed the second line to:
  MsgBox objinst.VolumeSerialNumber
But the first line gives me an Automation Error, 0x80041012.

--------
And two, I don't want to have to install WMI on 95/98/NT4 just to get at this one serial number, even if I do figure out how to get WMI to work.

Mick
March 20th, 2003, 06:33 AM
Originally posted by ryoken
Well, for one I just came across WMI today as a possibility while searching for info on finding SCSI serial numbers, and haven't found a clear example yet on how to do it that way. The example I found for VB doesn't work:
  set objinst = GetObject("WinMgmts::Win32_LogicalDisk='C:'")
  MsgBox (GetObject "WinMgmts::Win32_LogicalDisk='C:'").VolumeSerialNumber)
VB didn't like it. Changed the second line to:
  MsgBox objinst.VolumeSerialNumber
But the first line gives me an Automation Error, 0x80041012.

--------
And two, I don't want to have to install WMI on 95/98/NT4 just to get at this one serial number, even if I do figure out how to get WMI to work.

Can't help you with VB, could help you with C++. And yes WMI needs to be installed on those machines, but you have the ability to remotly retrieve information etc etc. Think of it as an extension of SNMP.

How are you retrieving the serial number with an IOCTL?

ryoken
March 20th, 2003, 06:37 PM
I agree that WMI looks nice, but I've got clients, not users. I can't (and don't want to) force them to install management software on their own personal machines. So there's no SNMP here to extend.

VC++ is fine with me, and actually preferable. I was only messing with VB, as that's what the example was in. If I could get it to work in VB, moving to VC++ wouldn't be an issue.

To retrieve IDE serial numbers we are using DeviceIoControl(), not ioctl(). However, SCSI drives don't seem to want to report a serial number though this call.

tempstack
March 21st, 2003, 02:30 AM
I am also working one this problem now.

Some other guys have suggested me to use the DDK programming:
"ssue a SCSI_PASS_THROUGH_DIRECT INQUIRY command. The adapter will pass
this command to the Physcial drive you open. Then you can see the product ID,
serial Number etc information in the inquiry info.
"

I am not familar with DDK programming.
Is here some body know this clearly?
If I have use the "SCSI_PASS_THROUGH_DIRECT " in my C file, which is defined in the DDK\inc\**.h.
Can I compile my C file as usual??
How can I begin with the DDK programmng?

Any now know this? I think it is seems resonable to use this way to get the SCSI infomation.

Thanks.

ryoken
March 21st, 2003, 10:29 AM
We've tried that method already, actually. The command works, you get back the drive's model and vendor ID's, but the serial number field is returned as an empty string.

We pulled all the defines and structures off MSDN Library help and other online sources and included them directly into our source instead of using the DDK header files themselves.