The new Viacom (VIAB) - Get Report  may soon be taking shape. 

In a trial planned for October, a Massachusetts court is expected to rule on whether Sumner Redstone, the company's controlling shareholder, was mentally competent to make a series of decisions that would remake the media company, owner of Paramount Pictures, MTV and other cable-TV networks such as Nickelodeon.

On Thursday, a Massachusetts probate court judge rejected a motion by Redstone's lawyers to throw out a lawsuit filed by CEO Philippe Dauman and director George Abrams that Redstone, Viacom's chairman emeritus, wasn't mentally fit to have both men removed from the holding company board that controls Viacom as well as a trust that will assume control of his $40 billion media empire when he does or becomes incapacitated.

Probate Judge George Phelan in Canton, Mass. rejected a motion by Redstone's lawyers to throw out the case, setting up the likelihood that a decision is near in the long-running and very public tug-of-war over who will run Viacom, owner of Paramount Pictures, MTV and Nickelodeon.

Phelan said that he would examine the 93-year-old Redstone's medical records and take additional testimony to determine whether Redstone, who is ailing, was competent to remove Dauman and Abrams from National Amusements Inc., the privately-held movie-theater chain that owns nearly 80% of controlling shares in Viacom and CBS (CBS) - Get Report , and the six-person family trust.

Redstone and his daughter Shari Redstone would have preferred that the Massachusetts court not taken up the Dauman-Abrams lawsuit thereby deferring to a Los Angeles court where they counter filed to uphold the National Amusements board changes.

The judge in that Los Angeles court, David J. Cowan, ruled in May in a separate case that Redstone was able to decide that he no longer wanted his former girlfriend, Manuela Herzer, to take charge of his healthcare needs. While Cowan didn't rule on Redstone's competency, he let stand the billionaire's decision to have Herzer removed from his home, declaring that he was sufficiently in charge of his faculties to preclude court action.

Both sides are also awaiting a related decision by Delaware Chancery Court regarding the June 16 decision of a newly-configured National Amusements board to replace Dauman, Abrams, Fred Salerno and two others as Viacom directors. The Delaware court is expected to hold a hearing on its case on Friday.

Nonetheless, Redstone's legal team said it remains confident that the Massachusetts court will ultimately decide that the media mogul was competent to change the board's make-up, and that he was acting in the best interests of a company that has largely struggled in recent years both in Hollywood and against streaming rivals led by Netflix (NFLX) - Get Report and Time Warner (TWX) .

"Sumner made the decision to remove Dauman and Abrams as Trustees and National Amusements directors, because he does not trust them, and to replace Salerno and four other Viacom directors because he is dissatisfied with Viacom's performance," Mike Lawrence, a spokesman for Redstone's legal team, said in an e-mailed statement. 

"We look forward to exposing this specious and malicious attack on the Redstones, and we believe that Mr. Dauman and Mr. Abrams will be no more successful at thwarting Sumner's wishes in Massachusetts than Manuela Herzer was in California," the statement read.

Shares of the beleaguered, embattled and just plain unsettled owner of paramount Pictures have gained 15% over the past month on expectations that long-awaited clarity about corporate control is near.

Dauman and Abrams charged in Massachusetts that Redstone's daughter Shari has used "undue influence" over her father, and that Sumner never intended her to take a lead role in managing the two companies. The two men, who continue to hold director positions at the company, said they were heartened that a Massachusetts judge would examine Redstone's medical records.

"We are grateful that Judge Phelan's thoughtful opinion removes yet another of defendants' efforts to block an investigation into the merits and, in particular, an independent determination of Mr. Redstone's capacity and the question of undue influence," a spokesman for Dauman and Abrams said in an e-mailed statement. "We also appreciate that he is allowing prompt access to medical records and immediate discovery."

Shari Redstone, Viacom's vice-chairman, has sparred with Dauman in recent years, arguing that the company needed new leadership. Not only has she questioned Dauman's compensation package but also urged the board earlier this year not to give the CEO the additional title of executive chairman, when it became clear that her father could no longer fulfill those duties.

Dauman is poised to receive a payout of $83 million in the event that he is removed as CEO.