Hello,
Does anyone know of any existing source code that replicates Windows Device Manager using Visual Studio? I would prefer VB but I can always convert C# to VB. I have found a few but they did not include a form that displayed the final product so I don’t know if they actually work.

Any help you can provide is appreciated

2 Spice ups

This looks like a different question to your existing topic.

You’ve only supplied part of the code and no real information about your objective, so it’s a bit harder to help you get where you want to be.

See my update on your other topic.

Hey Rod, I didn’t think I needed to go into detail about what I’m working on. I was just trying to fix an error that didn’t make sense given that the same code has worked in the past. I have pulled an old project out of mothballs and started working on it again. Part of the project is to gather as much configuration data about the PC as I can and write it to a database. This is one of the pieces of information that I want to include in the database. I like to be able to return a set of values similar to the Windows 11 About screen. There are other things as well, hard drive information, PC hardware information, device manager information, services, and other things. The goal is to capture the data, write it to a database, then write the routines to pull it back based on computer name or some other search key. Hope this helps

Ensure you have added a reference to System.Management and then you can take advantage of using WMI.

Imports System.Management
Imports System.Text

Module moduleWMIInfo

   Public Function GetWMIClass(wmiClass As String) As String

      Dim stringBuilderOutput As New StringBuilder(String.Empty)

      Try
         Dim managemenClass As New ManagementClass(wmiClass)
         Dim managementObjectCollection As ManagementObjectCollection = _
            managemenClass.GetInstances()
         Dim propertyDataCollection As PropertyDataCollection = managemenClass.Properties

         For Each managementObject As ManagementObject In managementObjectCollection
            For Each propertyData As PropertyData In propertyDataCollection
               Try
                  stringBuilderOutput.AppendLine(propertyData.Name + ":  " + _
                     managementObject.Properties(propertyData.Name).Value)

               Catch
               ' Handle your error here
               End Try
            Next
            stringBuilderOutput.AppendLine()
         Next

      Catch
         ' Handle your error here
      End Try

      Return stringBuilderOutput.ToString()
   End Function
End Module

' Example usage:
' Dim strOSInfo As String
' strOSInfo = GetWMIClass("Win32_SystemOperatingSystem")

*Edit: codestyle

Thanks for the suggestion, but there is no WMI in my project so far and I’d like to keep it that way. I think there is a problem with it on my system and that is what is causing the problem.