cpu

Have a look at the system.management libraries, and WMI, from here you can find all the information about local and remote systems.
 
WMI is the Windows Management Interface, it allows Administrators and Developers to configure and manage differant areas of local and remote machines. It uses the system.management namespace to access the WMI Libraries. Below is an example of Listing the services and there state on a remote or local Machine. If you look on MSDN or on some of the vbscripting sites you should be able to see some code that you can change to suit your needs. I found on one of the latest technet cds (Can not remember) a .chm document that had some vb scripts that I have started to convert to .net code. I think it was script_repository_1_1.chm, you might be able to seacrh the MSDN Site for it.

VB.NET:
  [size=2][color=#0000ff]
Imports[/color][/size][size=2] System.Management

[/size][size=2][color=#0000ff]Module[/color][/size][size=2] Module1

[/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Main()

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] query [/size][size=2][color=#0000ff]As[/color][/size][size=2] ManagementObjectSearcher

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] queryCollection [/size][size=2][color=#0000ff]As[/color][/size][size=2] ManagementObjectCollection

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] co [/size][size=2][color=#0000ff]As[/color][/size][size=2] ConnectionOptions

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] oq [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Management.ObjectQuery

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] ms [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Management.ManagementScope

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] mo [/size][size=2][color=#0000ff]As[/color][/size][size=2] ManagementObject

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] strComputerName, strQuery [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String

[/color][/size][size=2]Console.WriteLine("WMI List Services and there State")

strQuery = "SELECT * FROM Win32_Service"

[/size][size=2][color=#008000]' Ask for a computer name

[/color][/size][size=2][/size][size=2][color=#0000ff]Do

[/color][/size][size=2]Console.Write("Please enter server name (type 'localhost' for local machine): ")

strComputerName = Console.ReadLine()

[/size][size=2][color=#0000ff]Loop[/color][/size][size=2] [/size][size=2][color=#0000ff]Until[/color][/size][size=2] strComputerName <> ""

[/size][size=2][color=#008000]' Connect to the remote computer

[/color][/size][size=2]co = [/size][size=2][color=#0000ff]New[/color][/size][size=2] ConnectionOptions

[/size][size=2][color=#0000ff]If[/color][/size][size=2] (strComputerName.Trim().Length = 0) [/size][size=2][color=#0000ff]Then

[/color][/size][size=2]Console.WriteLine("Must enter machine IP address or name.")

[/size][size=2][color=#0000ff]Else

[/color][/size][size=2][/size][size=2][color=#008000]' Point to machine

[/color][/size][size=2]ms = [/size][size=2][color=#0000ff]New[/color][/size][size=2] System.Management.ManagementScope("\\" + strComputerName + "\root\cimv2", co)

[/size][size=2][color=#008000]' Query remote computer across the connection

[/color][/size][size=2]oq = [/size][size=2][color=#0000ff]New[/color][/size][size=2] System.Management.ObjectQuery(strQuery)

query = [/size][size=2][color=#0000ff]New[/color][/size][size=2] ManagementObjectSearcher(ms, oq)

[/size][size=2][color=#0000ff]Try

[/color][/size][size=2]queryCollection = query.Get()

[/size][size=2][color=#0000ff]Catch[/color][/size][size=2] e1 [/size][size=2][color=#0000ff]As[/color][/size][size=2] Exception

Console.WriteLine("Error: " + e1.ToString())

[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Try

[/color][/size][size=2][/size][size=2][color=#0000ff]For[/color][/size][size=2] [/size][size=2][color=#0000ff]Each[/color][/size][size=2] mo [/size][size=2][color=#0000ff]In[/color][/size][size=2] queryCollection

[/size][size=2][color=#008000]' create child node for operating system

[/color][/size][size=2]Console.WriteLine(mo("Name").ToString() + " [" + mo("StartMode").ToString() + "]")

[/size][size=2][color=#0000ff]Next

[/color][/size][size=2]Console.ReadLine()

[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]If

[/color][/size][size=2][/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub

End[/color][/size][size=2] [/size][size=2][color=#0000ff]Module

[/color][/size]
 
Back
Top