When installing Windows Virtual PC and Windows XP Mode in Windows 7, the installation may halt with the following error messages:

“The file could not be written.”
“Virtual hard disk could not be attached to the virtual machine. Please check the values provided and try again.”.

The error happens even though the computer hardware specifications have met the system requirements of Windows 7, including those specifically required for Windows Virtual PC, i.e hardware-assisted virtualization (test CPU for VT support).

The root cause of the problem while attempting to install and run Windows 7 Virtual XP Mode lies on Kaspersky Internet Security and Kaspersky Anti-virus or other similar security problem, which over zealously tries to protect the PC from unknown or potentially malicious application activities. In the case of Kaspersky, the Application Activity Analyzer proactive feature is likely causing the Windows XP Mode to fail to install or its virtual machine from running.

To fix the Windows XP Mode (XPM) setup error in Windows 7 for users who use the Kaspersky security product, try to disable the detection and scanning of Hidden Object in the Application Activity Analyzer or Proactive Defense setting (depends on version of Kaspersky). Windows XP Mode should be able to install properly after the setting is applied.

A more generic solution is to disable Kaspersky or any anti-virus solution installed on the system, and then reinstall Virtual Windows XP Mode. Windows XP Mode should install perfectly now. After installation completes, re-enable the anti-virus protection, and it won’t interfere with the working of Windows XP Mode.