CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2003
    Posts
    2

    How can I get the SCSI harddisk serial number?

    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

  2. #2
    Join Date
    Mar 2003
    Location
    Southern California
    Posts
    4
    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.

  3. #3
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Any reason why your not using WMI and CIM to get this type of information?

  4. #4
    Join Date
    Mar 2003
    Location
    Southern California
    Posts
    4
    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.

  5. #5
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    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?

  6. #6
    Join Date
    Mar 2003
    Location
    Southern California
    Posts
    4
    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.

  7. #7
    Join Date
    Mar 2003
    Posts
    2
    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.

  8. #8
    Join Date
    Mar 2003
    Location
    Southern California
    Posts
    4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured