In this paper, a microgrid hierarchical control scheme is proposed which includes primary and secondary control levels. The primary level comprises distributed generators (DGs) local controllers. The local controller mainly consists of active and reactive power controllers, voltage and current controllers, and virtual impedance loop. A novel virtual impedance structure is proposed to achieve proper sharing of non-fundamental power among the microgrid DGs. The secondary level is designed to manage compensation of voltage harmonics at the microgrid load bus (LB) to which the sensitive loads may be connected. Also, restoration of LB voltage amplitude and microgrid frequency to the rated values is directed by the secondary level. These functions are achieved by sending proper control signals to the local controllers. The simulation results show the effectiveness of the proposed control scheme.