Kyle MacLachlan guest stars on the 11/8/10 episode of How I Met Your Mother. His character shakes Ted's hand here.
Added:

How I Met Your Mother Season 6 Episode 8 Quotes

Zoey: Ted, this is my husband.
Ted: So Captain how did you get that name?
The Captain: I gave it to myself. A real man chooses his real name.

I didn't realize you were small potatoes, and to be clear I am referring to your testicles.

Robin