In the first incarnation of Brainiac, he was an green skinned android from the robot-dominated world of Colu who sought to collect information throughout the cosmos, coming into conflict with Superman over his diabolic capture of Krypton-One's city of Kandor. By the 30th century, his newest incarnation would be that of Pulsar Stargrave, possessing the power of the harness stellar energy which he used versus Superboy and the Legion of Superheroes. However, there was another version of this vile villain that appeared in the mid-1980s, himself consumed by a star going nova yet undergoing quite a different transformation from that of Stargrave, turning into ambient energy that assimilated into a cybernetic collective of a distant world. Transformed into an entity of organic metal and a cold calculating logic unmatched by any past or future versions of himself, this new Brainiac threatened not only his arch-foe Kal-El but the entire universe. Was such a threat made manifest on the parallel planet known as Earth-Two? Yes.
About a year about the metallic menace's debut in one realm, in another an entity known as the Commander appeared on Earth-Two leading an incursion from his own universe into that dimensional plane. Diverted there by Professor Champion of Earth-One, the Commander sought to capture this bright blue globe and its inhabitants, until challenged by its superhuman protectors. Soon the origin of this nefarious nemesis was crystallized as the Commander revealed himself to now be a machine hybrid, once a man, now collecting the conscious energies of his dimension's subjegated citizens.
Wishing to make his new home in the Earth-Two universe, he like his counterpart faced the Man of Steel. While on Earth-One, Superman was joined by the Justice League and Teen Titans in averting an invasion, here it fell upon the native Justice Society with the visiting Justice League and the Champion family assisting them. In both instances, Brainiac and Commander found a worthy implacable enemy in the Last Son of Krypton, who led the fight to topple these intergalactic egomaniacs from their insatiable thirst for conquest. In Brainiac's case, it was through Superman's manipulations of the sun to cause power spikes in the robotic rogue's cerebral cortex which cause him to lose his memory and plotting capabilities. Seeking refuge in hyperspace, the villain to humanity would next appear in the void between universes, having created a floating replica of Metropolis complete with a horde of Supermen robots that lured the Legion and the original Kryptonian Crusader into a trap. A trap they managed to circumvent, causing Brainiac to once more escape only to return during the Crisis on Infinite Earths to lead a villain war against five Earths.
In the case of the Commander, it took the combined cognitive capabilities of the Champion children and their aunt coordinated by Doctor Fate to create a dimensional rift, one into which Superman and his JSA and JLA allies could thrust the tyrant. Seeking to return him to his own universe, the Commander forced himself to remain in Earth-Two's plane of existence, at the cost of his own essence dissolving into all of that universe's reality, while the League and Society (like the Legion and Superman above) were thrust through dimensions into the void between universes albeit briefly. Interestingly, just as around the same time the evil robot Mekanique had left Earth-Two's universe for that of Earth-One and then a post-Crisis Earth... now the new Brainiac's cosmic twin the Commander left his native universe for that of Earth-Two's. Hence, the cosmic balance was restored, in part due to the unintentional interference of the Monitor and his apprentice Lyla.
Thus in each case, the seemingly insurmountable mental might of these machinized menaces did not prove a match for the heroes of two Earths... and their adopted sons from long extinct worlds... who like them were aliens of great power but unlike them used such might for right!