.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
Post New Web Links

WMI Flakiness

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :.NET Framework
 

I couldn't find a forum specific to WMI and this seemed like the best place to post this. I am using WMI to enumerate users of the computer but with some customers I am getting cryptic exceptions and/or the code doesn't work as expected. For one customer NO user account information is returned from this simple code:

      SelectQuery query = new SelectQuery("Win32_UserAccount", string.Format("Domain='{0}'", Environment.MachineName));
      ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
      foreach (ManagementObject mObject in searcher.Get()) {
        Console.WriteLine((string)mObject["Name"]);
      }

But for the same customer, I am able to enumerate groups using this code which produces output like "Administradores", "Convidados", "Distributed COM - Usuários", etc.

      SelectQuery query = new SelectQuer


View Complete Post


More Related Resource Links

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend