// Create WMI connection
ConnectionOptions options = new ConnectionOptions();
string machine = "127.0.0.1";
ManagementPath path = new ManagementPath(String.Format(
scope.Connect();
// Query
ObjectQuery query = new ObjectQuery(
ManagementObjectSearcher managerTemp =
//Get the results
ManagementObjectCollection returnCollection = managerTemp.Get();
foreach (ManagementObject managementObject in returnCollection)
{
ConnectionOptions options = new ConnectionOptions();
string machine = "127.0.0.1";
ManagementPath path = new ManagementPath(String.Format(
@"\\{0}\root\cimv2", machine));
ManagementScope scope = new ManagementScope(path, options);scope.Connect();
// Query
ObjectQuery query = new ObjectQuery(
"Select * from Win32_QuickFixEngineering");
ManagementObjectSearcher managerTemp =
new ManagementObjectSearcher(scope, query);
//Get the results
ManagementObjectCollection returnCollection = managerTemp.Get();
foreach (ManagementObject managementObject in returnCollection)
{
System.Console.WriteLine("*** New Item: ");
foreach (PropertyData propertyData in managementObject.Properties)
{
}foreach (PropertyData propertyData in managementObject.Properties)
{
System.Console.WriteLine(" {0} : {1}",
}propertyData.Name,
propertyData.Value);
propertyData.Value);
No comments:
Post a Comment