Detect Graphics Card Name

Is it possible to detect the graphics card name from .Net code? Yes it is possible using WMI. But you need to reference the System.Management and import it.

Windows Management Instrumentation

WMI is a great library which contains the details about various components required for the system to operate. Hard Disk Drive related information, processor information, Network components and the list goes on. It is really easy to query the data if you know a little about the data how it is organized.

Using WMI to Get the Graphics Card Name

WMI can be used to query a lot of information about hardware and Operating systems related information. ManagementObjectSearcher can be used to query the data. It accepts two parameters. The first parameter is to tell which section to search called as scope. And the second parameter is the actual query almost similar to SQL query. Using the Get method of ManagementObjectSearcher will give the result set in a collection.

Source Code

Imports System.Management

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, _

ByVal e As System.EventArgs) Handles Button1.Click


End Sub

Private Function GetGraphicsCardName() As String

Dim GraphicsCardName = String.Empty


Dim WmiSelect As New ManagementObjectSearcher _

(“rootCIMV2”, “SELECT * FROM Win32_VideoController”)

For Each WmiResults As ManagementObject In WmiSelect.Get()

GraphicsCardName = WmiResults.GetPropertyValue(“Name”).ToString

If (Not String.IsNullOrEmpty(GraphicsCardName)) Then

Exit For

End If


Catch err As ManagementException


End Try

Return GraphicsCardName

End Function

End Class

Source by Pon Saravanan