Sumner Redstone, chairman of Viacom and CBS, was ordered by a judge on Friday to undergo a one-hour mental exam to determine his competency.

Redstone, 92, has been engaged in a battle to keep his position after his ex-girlfriend said he was incapacitated. Manuela Herzer says she was also his caretaker.

The judge permitted the exam but denied a request by Herzer's lawyers to question Redstone under oath.

"We are gratified that the Court continues to reject Ms. Herzer's increasingly desperate and disingenuous attempts to depose Mr. Redstone," his attorney Gabrielle Vidal said.

The medical exam will be conducted by an expert that Herzer requested. Redstone's nurse and speech therapist will also be present.

Related: Viacom slashes Sumner Redstone's pay

Herzer's lawyer Pierce O'Donnell said in a statement earlier in January that Redstone wasn't competent to replace Herzer as his caretaker.

"The truth is this: Mr. Redstone is in rapidly failing health, has severe cognitive deficits, cannot write or speak intelligibly, and is simply incapable of making his own health care decisions."

O'Donnell also said he will be subpoenaing Viacom (VIAB) CEO Philippe Dauman, who is now in charge of Redstone's care.

Lawyers for both Herzer and Redstone are scheduled to appear in court on Wednesday. At that time a judge will consider Herzer's suit and Redstone's motion to dismiss her petition.

In November, Herzer was denied a petition to expedite the proceedings.

CNNMoney's Brian Stelter contributed to this report.