Results 1 to 2 of 2

Thread: Hard Drive Serial Number (RESOLVED)

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2004
    Posts
    35

    Question Hard Drive Serial Number (RESOLVED)

    I have the following code in sub main of my program. Work great in Windows 2000 or XP. In Windows 98 I get RTE '432" "File name or class name not found during Automation operation" The code is to get the hard drive serial number. The error occurs on the highlighted line.

    Private Sub Command1_Click()
    Dim HD As Object
    Dim x As Integer
    x = 0
    For Each HD In GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2").ExecQuery("select * from Win32_LogicalDisk")
    If HD.MediaType = 12 Then '/// make sure we only get hard-drives.
    If x = 0 Then'/// to allow only first to be shown.
    MsgBox HD.Caption & vbCrLf & HD.VolumeSerialNumber
    x = 1
    End If
    End If
    Next
    End Sub


    Has anyone any experience with this. Do I need to declare or register a class/file to get this to work on Win 98 machines?

    ANy assistance appreciated....

    thanks

    -jhs
    Last edited by jsalvin; Jun 16th, 2004 at 09:28 PM.

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2004
    Posts
    35

    Hard Drive Serial Number (RESOLVED)

    Never mind, had to install WMI Core v1.5 from microsoft first. All works now.

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