private ManagementObjectCollection GetSubFolders(string path) { if (path.EndsWith("\\")) path = path.Substring(0, path.Length - 1); Wmi cimv2 = new Wmi(ServerNameSettings, "root\\cimv2"); return cimv2.ExecuteWmiQuery("Associators of {Win32_Directory.Name='" + path + "'} " + "Where AssocClass = Win32_Subdirectory " + "ResultRole = PartComponent"); }