For this example to work you should set a reference to System.Management.
using System.Management;
private void Form1_Load(object sender, EventArgs e)
{
ConnectionOptions DemoOptions = new ConnectionOptions();
DemoOptions.Username = "admin";
DemoOptions.Password = "admin";
ManagementScope DemoScope = new ManagementScope("\\\\indiaop1\\root\\cimv2", DemoOptions);
ObjectQuery DemoQuery = new ObjectQuery("select * from win32_Product");
ManagementObjectSearcher DemoSearcher = new ManagementObjectSearcher(DemoScope, DemoQuery);
ManagementObjectCollection AllObjects = DemoSearcher.Get();
foreach (ManagementObject DemoObject in AllObjects)
listBox1.Items.Add(DemoObject["Caption"].ToString());
}
Wednesday, July 29, 2009
WMI : Extracting Installed Product Information of another machine
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment