SWbemObject class CIM_PhysicalMedia/ WIN32_PhysicalMedia

vb6 Thailand
  • 14 years ago

    I am trying to receive the physical media information according to my local CD-Rom drives by using WMI Scripting Object and the related classes.

    Def:

    Private oService As SWbemServices
    Private oSet As SWbemObjectSet
    Private oSet2 As SWbemObjectSet
    Private oSW As SWbemObject




       'Get Physical Disk Information - working fine

        Set oSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
                   InstancesOf("Win32_DiskDrive")


       'Get Logical Disk Information - working fine

        Set oSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
                   InstancesOf("Win32_LogicalDisk")


       'Get CDROM Disk Information - working fine

        Dim strServer As String
        strServer = "."
        Set oService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _
        & strServer & "\root\cimv2")



         Set oSet = oService.ExecQuery("Select * from WIN32_CDROMDrive ")

       'Get Physical Media Information - Do not get Information about my CDROM - Media

        Dim strServer As String
        strServer = "."
        Set oService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _
        & strServer & "\root\cimv2")



         Set oSet = oService.ExecQuery("Select * from WIN32_PhysicalMedia ")
       

    May someone have more experience with the WMI Interface and can help me according to this matter !

    Harald

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An idiot with a computer is a faster, better idiot” - Rich Julius