Falling asleep on the job (task) October 26, 2009
Posted by keithga in MDT 2010, VBscript.trackback
ZZzzzzzz…… (New for MDT 2010)
One of the new features of Windows 7 is a new aggressive power management policy. For machines that are plugged in, the new “Balanced” default policy will put a machine to sleep in 30 minutes. For Windows Vista, the default was 60 minutes.
For Deployments, that’s a problem if you have application installs that take longer than 30 minutes, like Microsoft Office 2007, with all the service packs. Half way through the deployment, the install pauses because the machine went to sleep.
I first noticed this in early tests of the Microsoft Deployment Toolkit 2010. I had written a utility for a similar problem back when I worked for Microsoft IT. It uses a Win32 API call: Win32 SetThreadExecutionState()
It’s a simple C/C++ call:
SetThreadExecutionState( ES_CONTINUOUS | ES_SYSTEM_REQUIRED );
This command resets the idle timer of the OS, and forces the machine to stay in a state while the Litetouch Task Sequence is running.
Updated (11/3/09):
KeepAlive was added to MDT 2010 in the Microsoft.BDD.Utility.dll file, you can see it being called in the litetouch.wsf script:
' Ensure that this machine does *not* go to sleep while running the task sequence steps. On error resume next oUtility.BDDUtility.KeepAlive On error goto 0
Keith
Keith Garner is a Deployment Specialist with Xtreme Consulting Group
Hi Keith,
Would you mind sharing that tool you wrote
?
Also, is ES_CONTINUOUS and ES_SYSTEM_REQUIRED flags cleared when the system is rebooted?
What I am thinking of is if you run a util that set the above at the beginning of the Lite Touch process. Would you need to run another util that that clears the EXECUTION_STATE flag at the end of the Lite Touch sequence? Or will it be cleared automatically when you reboot the computer using a Restart Computer entry in the Task Sequence?
Sorry I should have been more clear on this. KeepAlive was added to MDT 2010. The blog post above has been updated to reflect this.
Cool, thanks for the update