I am trying to figure out how to be able to query a remote server using wmi and then display the results in an aspx web page using vb.net.
I have downloaded and am using the WMI Code Creator to browse and determine which WMI queries I want to use, but all of the vb.net code it generates uses the console as the output. I am still new to this level of vb.net web development and do not know how I can modify this code to display the wmi query results on a web page.
Here is a sample bit of WMI code that the tool generates to get the operating system, make and model of the remote system.
Code:Imports System Imports System.Management Imports System.Windows.Forms Namespace WMISample Public Class MyWMIQuery Public Overloads Shared Function Main() As Integer Try Dim searcher As New ManagementObjectSearcher( _ "root\CIMV2", _ "SELECT * FROM Win32_ComputerSystem") For Each queryObj As ManagementObject in searcher.Get() Console.WriteLine("-----------------------------------") Console.WriteLine("Win32_ComputerSystem instance") Console.WriteLine("-----------------------------------") Console.WriteLine("Manufacturer: {0}", queryObj("Manufacturer")) Console.WriteLine("Model: {0}", queryObj("Model")) Console.WriteLine("Name: {0}", queryObj("Name")) Console.WriteLine("TotalPhysicalMemory: {0}", queryObj("TotalPhysicalMemory")) Next Catch err As ManagementException MessageBox.Show("An error occurred while querying for WMI data: " & err.Message) End Try End Function End Class End Namespace
I've been searching online with no solid examples on how to integrate wmi calls into a vb.net web page.
If anyone has any pointers or can assist in any way I would be very grateful for the help.
Thanks in advance,
Tim





Bookmarks