Jon Cryer has joined CBS’s Cupertino as a guest star, playing Judge Van Linkerspleen, a federal judge who works in a top-secret court. The character is an independent thinker who tries to judge fairly in an environment that values only compliance.

Cupertino is a legal drama set in Silicon Valley. It follows a lawyer, played by Mike Colter, who is cheated out of stock options by his former employer, a tech start-up. He teams up with another recently fired attorney, played by Rachel Keller, to represent people taken advantage of by the tech elite.

The series also stars Ella Stiller, Nik Dodani, Busy Philipps and Renée Elise Goldsberry.

“Jon Cryer was perfect, playing a judge you couldn’t tell was a good guy or a bad guy. We needed someone who could deliver the comedy but also dig into the moral dilemma of a judge who needs to follow the law in a deeply flawed system,” said Cupertino showrunners, co-creators and executive producers Robert King and Michelle King.

Cupertino airs Thursdays at 10 PM ET/PT on CBS. Beginning January 17, the series moves to Sundays from 10 to 11 PM.

The series is also executive produced by Liz Glotzer and Sam Hoffman.

Cryer won two Emmy Awards for playing Alan Harper on CBS’s Two and a Half Men, first in the Supporting Actor category and later in the Lead Actor category. He later starred in and executive produced NBC’s Extended Family and played Lex Luthor on the CW’s Supergirl. His additional credits include The Famous Teddy Z, Getting Personal, Partners, The Trouble with Normal, No Small Affair, Pretty in Pink, Hot Shots and Hiding Out.