Given the increasing expansion of power grids and their vulnerability to malicious attacks and natural disasters, it is necessary to consider measures to enhance the resilience of these networks against such events. Otherwise, irreparable damages may occur. This article investigates enhancing the resilience of a 33-bus IEEE power network against cyberattacks. It proposes a dynamic reconfiguration method that strategically switches to prevent network collapse and to reduce operational costs while maintaining voltage stability. Using MATLAB simulations, the study demonstrates that this approach effectively improves the network performance and the resilience in the face of cyber threats. The integration of renewable resources and a multi-objective optimization algorithm further support the management of distributed generation resources. Overall, the findings highlight the importance of adaptive strategies in maintaining the stability and efficiency of power microgrids under attack.