This paper proposes a power regulation scheme for dispatchable grid-connected distributed energy resource (DER) units based on the iterative learning control (ILC) strategy. The proposed control provides fast and stable control of the real and reactive powers that the DER unit delivers to the grid. In addition, it compensates the harmonic distortion of the grid current caused by the local nonlinear loads and delivers a high quality power to the grid. To this end, the paper presents the mathematical model on which the proposed control is based, as well as the control design methodology. A new MIMO iterative learning control with perfect power tracking and harmonic rejection performance as well as minor measurement requirements is proposed. The performance of the proposed ILC strategy is demonstrated through time-domain simulation of a grid-connected DER unit under various operating scenarios, and it is compared with the performance of the conventional control based on the instantaneous power theory (IPT).