Share via


Prevent date/time synchronization in a Windows Virtual PC virtual machine

If you need to prevent date and time synchronization between a Virtual PC 2007 virtual machine and its host machine, look at this post for the necessary steps but if you need to achieve the same result with a Windows Virtual PC virtual machine, you can do so by adding the following line to the vmc file for your virtual machine:

<preferences>
<hardware>
<bios>
....
....
<time_sync_at_boot type="boolean">false</time_sync_at_boot>
....
....
</bios>
</hardware>
</preferences>

You can achieve the above by also running the following visual basic script:

'Title: Script to disable timesync for a VM.

'Usage: cscript ScriptName <vmname>
Set objVPC = CreateObject("VirtualPC.Application")

'Get virtual machine name from command-line parameter
Set objVM = objVPC.FindVirtualMachine(WScript.Arguments(0))

'Disable TimeSync During Boot Time
errReturn = objVM.SetConfigurationValue("hardware/bios/time_sync_at_boot", false)

'Get object for GuestOS
Set objGuestOS = objVM.GuestOS

'Disable TimeSync During VM Execution
objGuestOS.IsHostTimeSyncEnabled = false

Copy the above in a file with the vbs extension and run it from a command-line prompt with the following instruction:

cscript x:\path\MyScript.vbs "MyVirtualMachineName"

where MyScript.vbs is the name of your script file, x:\path is the file full path and MyVirtualMachineName is the name of your WMV virtual machine.