I've got Windows Xp mode running on Windows 7. I would like to shutdown the Windows XP Mode Virtual PC every 24 hours,create a backup and then turn it on again? How do I go about doing this? I've been trying to do this with Windows task scheduler. I can startup the virtual pc Windows XP Mode vm at boot and I can shut it down after 24 hours. How do I start it up again after doing a backup. What would you suggest for creating backups of the .vhd or .vmc files? Thanks.

migrated from serverfault.com Dec 6 '13 at 21:00

This question came from our site for system and network administrators.


Here is my 2 cents:

I would personally do this with a batch file and have your scheduler run the batch file after shutting it down. I am a fan of backing up all files related to a VM, even if it's not necessary it gives me peice of mind.

@echo off  
set today=%date:/=-%
set vmcpath=%USERPROFILE%\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode.vmc
copy "%USERPROFILE%\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode.vhd"  "%USERPROFILE%\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode-VHD-%today%.backup"
copy "%USERPROFILE%\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode.vmc"  "%USERPROFILE%\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode-VMC-%today%.backup"
start vmwindow -file "%vmcpath%"

If I thought that out correctly, it should make a copy of the VHD and VMC files with the date and give it a .backup extension in the directory where the VM files live. If ran every 24 hours there shouldn't be any duplicates and the date helps make finding the one you want easier. The vmwindow.exe command at the end should start the XP Mode machine. Again, this is just what I could cook up in my head and using google so I am unable to test it but it should at least get you on the right track.

I found the directory for the files at this link: Files to backup in an XP Mode virtual machine

I found the command to run the VM at this link: Windows Virtual PC Executables

Let me know if this is what your looking for. I'm pretty new to the StackExchange sites and batch files in general, but I am always wanting to help people so I thought I'd give it a shot :-)

Update: I got a hold of a Windows 7 machine and put XP Mode on it. I updated the code above to reflect the changes I had to make to get it to work. It makes a backup of the files and then starts the VM successfully.


XP Mode may not be your best bet, I imagine Hyper-V and powershell may be a better combo.

There's a good script here that should do what you're looking for.


There's also another script here that may work.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy