The 2,448th star is located in front of the Frolic Room nightspot next to the Pantages Theatre on Hollywood Boulevard.
"As much as an honor as this is, unfortunately it won't be the first time I've been plastered on the sidewalk in front of the Frolic Room," Harris joked at the late-morning ceremony. "And, yes, that includes right now. Happy hour starts early in there."
"How I Met Your Mother" co-star, Jason Segal, and Joss Whedon, the creator of the musical online series in which Harris starred, "Dr. Horrible's Sing-Along Blog," joined Harris in speaking at the ceremony.
"I remember looking down at all those stars and seeing names like Mitchell Leisen and Spring Byington and Milton Sills and thinking, maybe someday in 100 years people will see my name and say, 'Who the hell was that person?'" said Harris.
Harris began his career as a child actor, and gained early fame for his role as Doggie Howser, M.D. in the 1989-93 ABC show with the same name.
He has received four Emmy nominations for outstanding supporting actor in a comedy series for his portrayal of the womanizing Barney Stinson on "How I Met Your Mother." Harris won Emmys last year for a guest-starring role on "Glee" and as the host of the 63rd Annual Tony Awards.
Harris' film credits include "Clara's Heart," "The Smurfs," "Harold and Kumar Go to White Castle" and its sequel "Harold and Kumar Escape from Guantanamo Bay," "Undercover Brother," "Starship Troopers," "The Next Best Thing" and "The Proposition." He will also appear in "A Very Harold & Kumar 3D Christmas" at the end of the year.
City News Service contributed to this report.