public void Execute() { try { WMIInstance.InvokeMethod(Method.Name, null, null); } catch { } }
private void backgroundWorkerBackgroundJob(object sender, DoWorkEventArgs e) { var wmiHelpers = new eWMI(); string computerName = ""; string nameSpace = ""; string wmiQuery = ""; string[] args; try { args = e.Argument as string[]; computerName = args[0]; nameSpace = args[1]; wmiQuery = args[2]; var results = wmiHelpers.InvokeQuery(computerName, wmiQuery, nameSpace); foreach (var result in results) { WMIInstance tempInstance = new WMIInstance(); foreach (var sysProperty in result.SystemProperties) { tempInstance.Properties.Add(new WMIInstanceProperty { PropertyName = sysProperty.Name, Type = sysProperty.Type.ToString(), Value = sysProperty.Value }); } foreach (var Property in result.Properties) { tempInstance.Properties.Add(new WMIInstanceProperty { PropertyName = Property.Name, Type = Property.Type.ToString(), Value = Property.Value }); } } } catch { throw; } }