They appear in Onikakushi-hen, when a paranoid Keiichi runs away from Ryūgū Rena, and knocked him out when they came in contact with him, so that Rena could bring Keiichi back to his house without being attacked while he was in an active LV5 state. Irie Kyōsuke ordered the Yamainu to keep a close watch on Keiichi when Ryūgū Rena and Sonozaki Mion told Irie about Keiichi's sudden suspicious and erratic behavior. However, the Yamainu's existence only drove Keiichi to be completely sure that everyone in Hinamizawa, regardless if he knows them or not, is out to kill him, due to the fact that there was a "needle" in one of the ohagi that Mion and Rena made for him, and that on that same morning, the Yamainu attempted to run Keiichi over with their van at a high speed. They attempt to secure Keiichi after he murders Mion and Rena in his home, however Keiichi ends up dying before that. The Great Hinamizawa Disaster (GHD) occurs with the Yamainu's assistance.
Along with being involved in committing the GHD, the Yamainu are also required to silence any survivors of the disaster and/or anyone from Hinamizawa who was outside the area of the massacre. In the sound novel, manga TIPS, and the anime's Yakusamashi-hen, the survivors either died due to suicide or "symptoms similar to acute heart failure" (all occured at the hospital). It is revealed in Yakusamashi-hen that a Yamainu soldier may have suffocated the victims to carry out a silent murder and lead doctors to diagnose the death as from acute heart failure (even today, it is common for doctors and forensic scientists to misdiagnose/be hesitant as to whether a bloodless death was really caused by heart failure or suffocation/asphyxiation). Hōjō Satoko in Yakusamashi-hen and Maebara Keiichi in Tatarigoroshi-hen were both observed by the medical personnel (some of which may be connected to "Tokyo" as well) to have direct conversations with a police detective, and then died of "acute heart failure" shortly after the detective leaves.
The Yamainu play a major role during the events of Matsuribayashi-hen when early on the day of Watanagashi Furude Rika is reported to be dead. As this throws Takano's plans of starting the Great Hinamizawa Disaster astray, she realizes that the report is faked. The Yamainu's spies in the prefectural police department attempt to confirm/deny this, however, they are forcibly stopped by Ōishi Kuraudo . Despite the report never being found out to be fake, Takano starts heavy surveillance of Rika's house with about four Yamainu observers constantly on watch. During this time, the Yamainu capture Tomitake Jirō from a hotel in Shishibone City and bring him back to the Irie Clinic while Takano interrogates Irie.
While questioning Irie, Takano becomes increasingly frustrated with a logical impossibility presented to her- before Watanagashi, Rika's house was under surveillance by the Yamainu, who confirmed no one had entered or left the residence besides Irie. Irie confirmed that Rika was in the house with a cold (to throw Takano off). Despite this, Rika's body turned up at Okinomiya station. After a call from Nomura, Takano orders the Yamainu to place Irie under heavy surveillance.
Irie notices that Tomitake was captured and begins to escape by car. Almost immediately afterwards a group of Yamainu armed with handguns chase after him in one of their vans on a forest road. One of them takes out Irie's car with a shot aimed at the tires, and afterwards a few of them go to secure Irie. They are stopped by Tatsuyoshi Kasai's car along with Sonozaki Shion but continue to follow as it heads to the Sonozaki manor. The control room at the Irie Institution is able to track them due to a tracker they placed underneath Irie's lab coat.
Once Irie, Kasai and Shion arrive at the Sonozaki manor, several other backup vans along with Okonogi arrive to secure the estate. Here they make use of plastic explosives to break down a large door to the Sonozaki torture chamber as well as night vision equipment to see in the dark due to having cut the electricity (along with the phone lines in Hinamizawa to prevent contact to the police/the Banken) . While invading the chamber they used hand grenades and possibly assault rifles to secure the area. After abducting Rika, some of the men go back into the basement in order to eliminate the rest of the group protecting her, as the few along with Okonogi go to bring Rika back unconscious. A few men are injured as Akasaka Mamoru rescues Rika and nearly incapacitates Okonogi. The forces retreat while the opposing side sets up a plan to use Irie's tracker bug as a decoy while sending the club members into the mountains with it. The Yamainu are unaware of this plan and subsequently pursue the club with most of their squad, leaving about eight guards in the Irie Institution.
The control center van containing Major Takano and the main radio hub as well as around four other vans head out into the mountains, facing off against the club with taser guns. These prove to be useless against the club's ability to work together and Hōjō Satoko's prowess with traps. Meanwhile, Irie, Kasai, Akasaka and Shion infiltrate the Irie Institution, incapacitate the eight guards, ruin the Control Room's main interface and place Hōjō Satoshi in a safer area for recovery. After Tomitake is released, he and Akasaka escape to Okinomiya after facing off against two Yamainu securing the borders of Hinamizawa armed with RPGs and assault rifles. Tomitake calls in the Banken, another military organization under the control of 'Tokyo' for assistance in keeping the research secret.
Eventually, most of the Yamainu in the mountains is wiped out. Okonogi shows his skills in melee fighting against Mion but is defeated easily. He considers the entire ordeal to be over, and reveals to Takano that due to this failed scenario that Nomura is going to have her be killed. He tells the rest of the Yamainu to surrender to the incoming Banken while offering a handgun to Takano for the purpose of killing herself. Afterwards, Okonogi surrenders along with the rest of his troops while assuming the entire incident will be wrapped up neatly by 'Tokyo'.