B-4 in 2378
Two additional prototype brothers
As a prototype unit, B-4's positronic brain was considerably less advanced than his younger brothers' Lore and Data. This meant that B-4 would often ask simple questions and call out the names of people and objects that he recognized.
Sometime prior to 2378, Shinzon discovered B-4 and decided that he could use the android as part of an elaborate scheme to draw Captain Jean-Luc Picard near to Romulus so that he could capture him. Shinzon had B-4 equipped with a second memory port which had subversive programming installed into it; with which compelled B-4 to access Starfleet computer systems and download vital data in ship movements and their coded communications frequencies. Following the installation of these additions, Shinzon had B-4 disassembled and scattered across the surface of Kolarus III, so that he could draw Picard in.
Shinzon's plan paid off as the USS Enterprise-E was drawn to Kolarus III after detecting a positronic signature on the planet's surface. The dissembodied android was then returned to Enterprise and reassembled. Data soon became aware of B-4's limitations, but decided to copy all of his memories to him, in the hopes that Data's added experience would help B-4 expand beyond his programming. Unfortunately, B-4 had to be deactivated soon afterward when his part in Shinzon's plot was revealed.
A short time later, Data perished while destroying the Scimitar, having voluntarily sacrificed himself to save Captain Picard. B-4 was reactivated so that Picard could tell him of his brother's death, but Picard sadly departed the meeting when his attempts to explain what Data meant to them only confused B-4. With his future uncertain, Picard had noted some of Data's downloaded memories beginning to surface as B-4 began to sing the song "Blue Skies", which Data had performed at Will Riker and Deanna Troi's wedding. (Star Trek Nemesis)
Following Data's death, B-4's matrix failed to restore Data's memories. By 2399, B-4 had been disassembled and was stored at the Division of Advanced Synthetic Research at the Daystrom Institute in Okinawa. His components were visited in 2399 by Picard, after his retirement. According to Dr. Agnes Jurati, B-4 was "not much like Data at all," and most of Data's positronic network was lost after the transfer. (PIC episode: "Remembrance")
Shortly after Data's death aboard the Reman warbird Scimitar, B-4 was reactivated, and while some of Data's memories began to surface, his programming failed to expand as he was still reduced to asking simple questions and parroting the words of those around him. In 2380, he was relocated to the Daystrom Institute, where scientists planned to disassemble him in an attempt to replicate a Soong-type android. This was opposed by Captain Bruce Maddox, who made a legal petition to the Federation Judiciary Committee, the highest court in the Federation. After testimony from the Doctor, he was declared a sentient being and therefore could not be disassembled. (TNG novel: Resistance; ST novel: Articles of the Federation)
Return of Data
In 2384, during a raid on the Daystrom Annex of Galor IV, B-4 and a handful of other androids were stolen from the lab. After the incident, the USS Enterprise-E was sent to investigate, locking down the planet in the process. Unfortunately for the Federation, the raiding team had already left with the stolen androids. Unbeknownst to the Enterprise at the time, Noonien Soong had been on the planet and was subsequently picked up on facial recognition sensors in the city nearest the Daystrom Annex. Upon learning of this fact, several away teams from the Enterprise were mobilized to intercept the "Soong-type android", but he managed to evade all of them. Upon reaching his ship in orbit, Soong lead the Enterprise to an abandoned factory full of inactive androids, one which was being reactivated by the Breen in an attempt to manufacture their own Soong-type androids. B-4 had been captured for this select purpose, the Breen wanted to study B-4 in an attempt to copy this into the androids made at the factory. After a short fight, an away team from the Enterprise managed to recapture B-4 and the remaining androids, before being beamed back to the ship. This however, was after Noonien Soong managed to fix B-4's degrading mind and "resurrect" Data. This was achieved by removing the memories from B-4 and transferring them into a new android body, specifically the one Soong had made for himself. Thus, Data's memories were removed from B-4, allowing his mind to stabilize and having received an upgrade to his firmware at the same time. After the incident, B-4 requested to be taken back to the Galor IV Annex to assist Captain Bruce Maddox in his continued research of Soong-type androids. (TNG - Cold Equations novel: The Persistence of Memory)
Path to 2409
The Soong Foundation's science team and Geordi La Forge worked to subvert his personality in favor of the "Data" personality. In 2385, the group managed to unravel the Data matrix, allowing for all of Data's memories, personality and experiences to override B4's. When Data first returned to consciousness, he refused to allow himself to exist at the expense of his brother's life. He therefore created a program in his mind to destroy his own consciousness before it destroyed B-4's. However, B-4 commandeered the program and, having heard that Data was crucial to the war with the Undine, deleted himself before Data could stop him. Data therefore survived in B-4's body.
Through this, Data was able to help the Soong Foundation in upgrading positronic brains and help in the recreation of the emotion chip originally developed by Doctor Soong. Ambassador Spock likened it to his resurrection a hundred and two years previously, though Data likened it more to a return. Meanwhile, a backup copy of B-4 was saved, and thus the science team hoped to create a "B-4 matrix", and possibly eventually bring Data's brother back to life in a new body. (ST comic: "Countdown, Number Two"; ST website: The Path to 2409; STO novel: The Needs of the Many)
In 2409, Data entered a highly secure room where he activated a positronic circuit on an identical android he called "brother". (STO short story: "Unexpected Honor")