Neil Patrick Harris worked on How I Met Your Mother.
How I Met Your Mother . Among the 208 episodes , there were only four directors : Pamela Fryman ( 196 episodes ) , Rob Greenberg ( 7 episodes ) , Michael Shea ( 4 episodes ) , and Neil Patrick Harris ( 1 episode ) . Neil Patrick Harris . On television , he is known for playing the title character on Doogie Howser , M.D. ( 1989 -- 1993 ) , Barney Stinson on How I Met Your Mother ( 2005 -- 2014 , for which he was nominated for four Emmy Awards ) , and Count Olaf on A Series of Unfortunate Events ( 2017 onward ) .