Hyper-V WMI: Creating a Thumbnail Image

Posted by Bink on on July 29 2008, 4:35 PM with no comments

Hyper-V has a WMI API that will allow you to create a thumbnail image of any running or paused virtual machine.  You can create any sized thumbnail you want (640x480, 800x600, 1024x768 etc…).  Creating the image is pretty easy, you just call GetVirtualSystemThumbnailImage passing a reference to an Msvm_VirutalSystemSettingData instance and the size of the image you want…  However getting something useful from the returned data is a bit tricky…  You get an array of unit8’s that represent pixels, the API doesn’t have much choice and luckily Powershell makes this not an impossible feat.  All you have to do is create a new bitmap object and read (marshal) the pixel data into the object…  So here’s a script for you!

Windows Server 2008 - x64_running Windows Server 2008 - x64_saved
Running Virtual Machine Saved Virtual Machine

 

Continue At Source for the Powershell script

8825 Views
Source: blogs.msdn.com
2008 (C) Steven Bink, Bink.nu BV
Microsoft and Microsoft Logo’s are trademarks of Microsoft Corporation.