Programmatically keeping the VM screen on

A while I ago I did a blog post on how Windows will "turn off" our virtual computer screen to "save energy" (you can read about it here).  Recently, I was contacted by a team inside Microsoft who wanted to figure out how to stop this from happening - programmatically.

Their problem was that they were using our Thumbnail API (you can read about it here) to grab copies of the virtual machine screen - and were frustrated when it stopped updating.  Thankfully - the solution was easy:

  • For Windows virtual machines - run: "powercfg /setacvalueindex SCHEME_CURRENT SUB_VIDEO VIDEOIDLE 0" inside the virtual machine
  • For Linux virtual machines - run: "xset s off" inside the virtual machine

Now the screen will always be on, and the thumbnail will always be up-to-date.

Cheers,
Ben