Click here to Skip to main content
Click here to Skip to main content

Tagged as

WMI Reader

, 12 Sep 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
WMI Reader, also includes known WMI list.

Introduction 

WMI (Windows Management Instrumentation) provides programmers with information about the Operating System. This project includes the known WMI list.

Using the code

The Wmis.csv file contains the WMI paths like this:

  • Keyboards and Pointing Devices;Win32_Keyboard
  • Keyboards and Pointing Devices;Win32_PointingDevice
  • Mapped Drives and File Shares;Win32_ConnectionShare
  • Mapped Drives and File Shares;Win32_LogicalShareAccess
Private Sub LineUp()
    Const FileName As String = "WMIs.csv"

    Using fs As New FileStream(FileName, FileMode.Open)
        Using sr As New StreamReader(fs)
            While (sr.Peek > -1)
                Dim Line As String = sr.ReadLine
                Dim params() As String = Line.Split(";")
                Dim RootNode As TreeNode

                If Not twWMIs.Nodes.ContainsKey(params(0)) Then
                    Dim newNode As New TreeNode(params(0))
                    newNode.Name = params(0)

                    twWMIs.Nodes.Add(newNode)
                    RootNode = newNode
                Else
                    RootNode = twWMIs.Nodes.Find(params(0), False)(0)
                End If

                ' Set Nodes
                Dim WMINode As New TreeNode(params(1))
                WMINode.Name = params(1)

                RootNode.Nodes.Add(WMINode)
            End While
        End Using
    End Using
End Sub

Points of Interest

You can use WMI to learn information about your computer, Operating System, etc... For example, network card mac address, installation date of OS, processor ID, etc... Please be sure to use the UAC settings. You may need the admin rights while reading some WMI information...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Can SARIGÜL
Software Developer
Turkey Turkey
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 12 Sep 2012
Article Copyright 2012 by Can SARIGÜL
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid