EXHIBIT 23.1 CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM We consent to the incorporation by reference in the Registration Statement (Form S-8 No. 333-128840) pertaining to the 2005 Stock Plan for Directors and the 2005 Management Stock Incentive Plan, the Registration Statement (Form S-8 No. 333-120078) pertaining to the Stock Option Agreement Dated as of October 25, 2004 and the Restricted Share Unit Agreement Dated as of October 25, 2004, the Registration Statement (Form S-8 No. 333-112940) pertaining to the Stock Option Agreements dated as of January 4, 1999, May 5, 1999, January 3, 2000, January 2, 2001, December 14, 2001, January 2, 2002, June 19, 2002, October 25, 2002, January 2, 2003, February 27, 2003, and January 2, 2004, the 2003 Non-Employee Directors' Stock Option Plan, the 2003 Management Stock Incentive Plan, the Registration Statement (Form S-8 No. 333-86600) pertaining to the EMCOR Group, Inc. Stock Option Agreements dated as of January 4, 1999, February 23, 1999, January 3, 2000, March 3, 2000, January 2, 2001, and December 17, 2001, the Registration Statement (Form S-8 No. 333-75449) pertaining to the 1997 Non-Employee Directors' Non-Qualified Stock Option Plan of EMCOR Group, Inc. and the 1997 Stock Plan for Directors of EMCOR Group, Inc., the Registration Statement (Form S-8 No. 333-02819) pertaining to the 1994 Management Stock Option Plan of EMCOR Group, Inc. and 1995 Non-Employee Directors' Non-Qualified Stock Option Plan of EMCOR Group, Inc., of our reports dated February 20, 2007, with respect to the consolidated financial statements and schedule of EMCOR Group, Inc., EMCOR Group, Inc. management's assessment of the effectiveness of internal control over financial reporting, and the effectiveness of internal control over financial reporting of EMCOR Group, Inc., included in the Annual Report (Form 10-K) for the year ended December 31, 2006. Stamford, Connecticut /S/ ERNST & YOUNG LLP February 20, 2007