c# - Getting "Invalid query" ManagementException -


i trying system information of machine in domain. below code that.

connectionoptions opt = new connectionoptions(); opt.authentication = system.management.authenticationlevel.packet; opt.impersonation = impersonationlevel.impersonate; opt.enableprivileges = true; opt.username = strusername; opt.password = strpassword;   managementpath p = new managementpath("\\\\" + strservername + "\\root\\cimv2");  managementscope scope = new managementscope(p, opt);  objectquery query = new objectquery("select architecture win32_processor");  managementobjectsearcher search = new managementobjectsearcher(scope, query);  managementobjectcollection results = search.get(); managementobjectcollection.managementobjectenumerator e = results.getenumerator(); e.movenext();  ushort arch = (ushort)e.current["architecture"]; 

i getting exception of invalid query on e.movenext() line.this code running fine machine in machine giving such exception. don't know why exception occur , how solve it?


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -