i have the code which find all local users:
ManagementObjectSearcher userSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_UserAccount");
foreach (ManagementObject user in userSearcher.Get())
{
if ((bool)user["LocalAccount"])
{
string UserName = (string)user["Name"];
}
}
return;
now i want code which help me to select all groups in which user consist. I know that there is table called Win32_GroupUser and i must use PartComponent to indicate user name but i cant create query. Please help with information about WQL.