How to prevent standby mode when running XP-Mode programs or Virtual Machine
Hi,Normally my PC enters standby mode after some period of doing nothing. That's good.I also use the XP-Mode functionality for perfoming some tasks without polluting my Windows 7 installation. For example downloading files from newsservers.I am searching for a way to automatically prevent my computer entering the standby mode when I am running a program on a Virtual Machine using the integration mode.In short: when I am running a Virtual Machine I do not want my PC to enter the standby mode. If I am not running any Virtual Machine it is ok to enter the standby mode after some period of inactivity.Of course I do not want to turn standby mode on or off manually everytime I start or stop a Virtual Machine. I want this being done automatically.I know I could also run a program as Insomnia which is a really simple program that blocks the standby mode as long as it is running. But I don't want to use such program too. Is there any way to setup the standby mode in such way that it detects a running Virtual Machine and block the standby mode as long as it is running?Does somebody know a tip or trick to make this work?
December 26th, 2009 2:34pm

Not that I'm aware of. I don't use standby mode though on any machine running virtualization, but my circumstances are different from yours since I don't use it on Windows 7, I run Hyper-V on 2008 Server and let those do the work. You do already have the power saving features of the nic disabled on the host and virtual instances right?MCSE, MCSA, MCDST [If this post helps to resolve your issue, please click the "Mark as Answer" or "Helpful" button at the top of this message. By marking a post as Answered, or Helpful you help others find the answer faster.]
Free Windows Admin Tool Kit Click here and download it now
December 26th, 2009 5:44pm

I don't use Hyper-V on 2008 Server on my home PC, that is a bit overkill a guess. At my work I am using it since a few weeks.I didn't check the power saving features on the virtual machines yet. On the host machine (Windows 7) power saving is enabled and that is ok for me because when I don't have a Virtual Machine running the host is allowed to go to the hybrid standby mode.I could not find the power saving features of the Virtual NIC of the Virtual Machine I am running. The guest OS is a Windows XP. The general power saving options were not set to 'always on'. I changed this option. I'll have to test if this prevents the host to go into standby mode.
December 27th, 2009 1:57am

There is no solution for your requirement. You may try a workaround that change the power settings of your Windows 7 system by batch files. You may launch Power Options and manually create a power plan. Please disable standby mode in this plan. Then enter the following command in command prompt to query all of the plans. powercfg –list From the list you can see the GUID of your current used power plan and the plan you created yourself. To active a power plan, you can use the following command. powercfg -setactive <SCHEME_GUID> Before using Windows XP Mode, you may set your customized plan as active. After you close Windows XP Mode, you may set your default power plan as active again. You can make batch files for each commands and simply launch batch files when you need to run one of the commands.Arthur Xie - MSFT
Free Windows Admin Tool Kit Click here and download it now
December 31st, 2009 9:16am

Hi Arthur,The workaround you suggested works for me. I made a Powershell script in which I change the Power Configuration to a power plan which has been setup in a way that the computer always stays on. This is the standard power plan 'High Performance' or 'Hoge prestaties' in Dutch. Then it will startup a shortcut passed as parameter to this Powershell script. After that it looks for the Virtual Machine with the name also provided through a parameter to this script. The script then waits until this Virtual Machine enters one of the following states: 'Turned Off', 'Pauzed' or 'Saved'. When the Virtual Machine enters one of these states it will try to find out if there are no more Virtual Machines running and if that is the case it will set the Power Configuration to the powerplan 'Balanced' or 'Gebalanceerd' in Dutch. This power plan has been setup to use the hybrid standby mode.There is still room for improvements but for me it is working fine now. I simply have to run this Powershell script and pass the Virtual Machine name and a full path to a shortcut to it. The shortcut used is a shortcut created from Start -> All Programs -> Virtual PC -> [Virtual Machine Name] Programs -> [Some program installed inside the Virtual Machine]Power Configuration:C:\Users\Theo>powercfg -list Bestaande energiebeheerschema's (* actief)-----------------------------------GUID van energieschema: 381b4222-f694-41f0-9685-ff5bb260df2e (Gebalanceerd) *GUID van energieschema: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (Hoge prestaties)GUID van energieschema: a1841308-3541-4fab-bc81-f71556f20b4a (Energiebesparing)Powershell script 'startVMshortcut.ps1':param([string]$vmName,[string]$shortcut) # Check for correct command-line arguments If ($vmName -eq ""){ write-host "Missing command-line argument." write-host "USage: StartVMShortcut.ps1 -vmName `"Name of virtual machine`" -shortcut `"path to shortcut`"" exit } If ($shortcut -eq ""){ write-host "Missing command-line argument." write-host "USage: StartVMShortcut.ps1 -vmName `"Name of virtual machine`" -shortcut `"path to shortcut`"" exit } # Change the Power Configuration to 'always on'write-host "Changing Power Configuration to always on ..."powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c # Start the the shortcutwrite-host "Starting shortcut" $p = [diagnostics.process]::start($shortcut)write-host "Waiting for command to finish"$p.WaitForExit() # Wait some time to let the Virtual Machine state being changedStart-Sleep -s 5 # Connect to Virtual PC$vpc=new-object –com VirtualPC.Application # Get Virtual machine object$vm = $vpc.FindVirtualMachine($vmName) write-host "Wait for Virtual Machine to enter the state TurnedOff, Saved or Paused"#typedef enum {# vmVMState_Invalid = 0,# vmVMState_TurnedOff = 1,# vmVMState_Saved = 2,# vmVMState_TurningOn = 3,# vmVMState_Restoring = 4,# vmVMState_Running = 5,# vmVMState_Paused = 6,# vmVMState_Saving = 7,# vmVMState_TurningOff = 8,# vmVMState_MergingDrives = 9,# vmVMState_DeleteMachine = 10 #} VMVMState; while (($vm.state -ne 1) -and ($vm.state -ne 2) -and ($vm.state -ne 6)) { # wait until VM state changes Start-Sleep -s 30} $vm_running = $false # Change the Power Configuration to 'balanced' when no Virtual Machines are running anymoreforeach($vm in $vpc.VirtualMachines){ if ($vm.state -eq 5) { write-host $vm.name " is still running, state " $vm.state $vm_running = $true } else { write-host $vm.name " is not running, state " $vm.state }} if ($vm_running -eq $true){ write-host "There is at least 1 Virtual Machine Running. Power Configuration will not be changed back to 'Balanced'"}else{ write-host "No Virtual Machine is running. Changing Power Configuration to 'Balanced' (allowing sleep mode)" powercfg -setactive 381b4222-f694-41f0-9685-ff5bb260df2e}Example:The name of the Virtual Machine is 'Downloader'.The powershell script 'startVMshortcut.ps1' is located in the directory 'E:\Virtual Machines'.The shortcut 'SABnzbd (Downloader).lnk' is the shortcut that I want to run and it is saved on 'E:\Virtual Machines'The target of this shortcut 'SABnzbd (Downloader).lnk' is: %SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\VMCPropertyHandler.dll,LaunchVMSal "Downloader" "||4484092f" "SABnzbd"The command to run the SABnzbd program that is installed inside the Virtual Machine 'Downloader' is:powershell -File "E:\Virtual Machines\startVMshortcut.ps1" Downloader "E:\Virtual Machines\Virtual PC\Downloader\SABnzbd (Downloader).lnk"If you do not want a command prompt or Powershell prompt to be seen you could add some extra parameters to the powershell command to prevent this. The command would then be:powershell -NoLogo -NonInteractive -WindowStyle hidden -File "E:\Virtual Machines\startVMshortcut.ps1" Downloader "E:\Virtual Machines\Virtual PC\Downloader\SABnzbd (Downloader).lnk"I've put the command above in a shortcut on my desktop and it works as expected! However I can imagine that in some cases the Power Configuration will not be set to 'Balanced' again due to the fact that another Virtual Machine is still running and my script is not aware of a Virtual Machine being started without adjusting the Power Configuration through the Powershell script. If the Virtual Machine 'Downloader' enters the 'Saved', 'Turned Off' or 'Paused' state in this case it detects a Virtual Machine still running and skips turning back the Power Configuration. This could be fixed when the script is changed in a way that it will keep on waiting until no other Virtual Machine is running. I think this will not happen often in my case.Thanks again Arthur for pointing me in the right direction!
January 1st, 2010 1:45pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics