Following is my code to get UUID of my PC. I'm finding Error. Pls help me to resolve the errors. I'm getting Error on "ManagementObjectSearcher" is not defind & "ManagementObject" is not defind.
Option Strict On Imports System Imports System.Management Imports System.Windows.Forms Imports Microsoft.VisualBasic Imports System.Diagnostics Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim readValue As String Try Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_ComputerSystemProduct") For Each queryObj As ManagementObject In searcher.Get() Console.WriteLine("-----------------------------------") Console.WriteLine("Win32_ComputerSystemProduct instance") Console.WriteLine("-----------------------------------") readValue = "UUID: " & queryObj("UUID") RichTextBox1.Text = RichTextBox1.Text & Chr(13) & Chr(10) & readValue Next Catch err As Exception MessageBox.Show("An error occurred while querying for WMI data: " & err.Message) End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)