Hello
I try to list all windows user using this code but it throws exception of invalid query , I am using win vista.
the code:
can some one help me?
I try to list all windows user using this code but it throws exception of invalid query , I am using win vista.
the code:
Code:
try
{
SelectQuery sQuery = new SelectQuery("Win32_UserAccount","Domain=’ALI-PC’");
ManagementObjectSearcher mSearcher = new ManagementObjectSearcher(sQuery);
// String[] winUsers = null;
int i = 0;
foreach (ManagementObject mObject in mSearcher.Get())
{
// winUsers[i] = ((String)mObject["Name"]);
// MessageBox.Show(winUsers[i]);
i++;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Comment