Connecting electric storage technologies to smartgrids will have substantial implications in building energy systems. Local storage will enable demand response. Mobile storage devices in electric vehicles (EVs) are in direct competition with conventional stationary sources at the building. EVs will change the financial as well as environmental attractiveness of on-site generation (e.g. PV, or fuel cells). In order to examine the impact of EVs on building energy costs and CO2 emissions in 2020, a distributed-energy-resources adoption problem is formulated as a mixed-integer linear program with minimization of annual building energy costs or CO2 emissions. The mixed-integer linear program is applied to a set of 139 different commercial buildings in California and example results as well as the aggregated economic and environmental benefits are reported. The research shows that considering second life of EV batteries might be very beneficial for commercial buildings.