To maintain access to the compromised system, the attacker modified the system registry keys to ensure a malicious script executes automatically upon system reboot. This persistence mechanism allows the attacker to regain access without manual intervention.