|
| Getting hardware information |
 |
Sun, 23 Mar 2008 00:43:51 +000 |
Hi, I'm trying to get my machine info in C#, then I've found examples using the
System.Management namespace. But, the managementObjectSearcher class uses some
kind of language, like SQL, to retrieve the information, it's ok because I can
work with SQL, but I need a reference where I can found the "tables"
and "columns" of each resource. For example, I've seen I can use the
"Select Name from Win32_CDROMDrive" to get the names of the CDROM
drives, but I need a doc source to know which other tables I can work with,
which other columns I'd get from the Win32_CDROMDrive table, for example, and so
on. What's the name of this SQL-like language? Where I can learn about it?
Thank you guyz.
|
| Post Reply
|
| Re: Getting hardware information |
 |
Sun, 23 Mar 2008 04:37:49 +000 |
Its WMI . Scripting Guy will give you good information to start with
http://www.microsoft.com/technet/scriptcenter/resources/qanda/hsgarch.mspx
|
| Post Reply
|
| Re: Getting hardware information |
 |
Mon, 24 Mar 2008 03:27:13 +000 |
Hi! I would like to do the same here!
But I want to get the hardware info of a computer over the internet? Is this
posible? Do I have to use a script or can I use C#?
As you can see I'm lost here! I have never done anything like this and I have
NONE experience on scripting! ... can anyone please help me?
thanks!
|
| Post Reply
|
| Re: Getting hardware information |
 |
Tue, 25 Mar 2008 14:38:38 +000 |
chan29:But I want to get the hardware info of a computer over the internet?
In general you can't (and this is a good thing... I really don't want any old
web page to see anything more than what browser I'm running).
Within an organisation you can use WMI directly.
|
| Post Reply
|
| Re: Getting hardware information |
 |
Wed, 26 Mar 2008 00:57:27 +000 |
rjcox:
In general you can't (and this is a good thing... I really don't want any old
web page to see anything more than what browser I'm running).
Within an organisation you can use WMI directly.
Ok richard, I understand your point... but I still want to develop a web page
that can show you some info from your computer, what would you suggest to do in
this case? Should I make the client isntall a software so the WMI can run
locally, or is there any other (better) solution? Is any different to try to do
this in a script rather than using the .NET Framework and C#?
I have tried to run this very small console application:
using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
namespace WMI.Remote.Test
{
class Program
{
static void Main(string[] args)
{
ConnectionOptions co = new ConnectionOptions();
//co.Username = "Administrador";
//co.Password = "admin";
//co.Authority = "ntdlmdomain:domain";
//ManagementScope ms = new
ManagementScope("\\\\201.212.68.22\\root\\cimv2", co);
//ManagementScope ms = new
ManagementScope("\\\\192.168.1.2\\root\\cimv2", co);
ManagementScope ms = new
ManagementScope("\\\\192.168.1.1\\root\\cimv2", co);
ms.Connect();
ObjectQuery oq = new ObjectQuery("SELECT * FROM
Win32_Processor");
ManagementObjectSearcher mos = new ManagementObjectSearcher(ms,
oq);
foreach (ManagementObject mo in mos.Get())
{
Console.Write("Procesador: ",
mo.GetPropertyValue("Name"));
Console.WriteLine("\nPress any key too continue...");
Console.ReadLine();
}
}
}
}
with no luck...
again.. any help will be really appreciated
|
| Post Reply
|
|
|
|
|
|
|
|
|
|