¿ù°£ Àα⠰Խù°

°Ô½Ã¹° 256°Ç
   
HYPER-V VM Image capture - Hyper-V WMI: Creating a Thumbnail Image
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2013-02-13 (¼ö) 12:28 Á¶È¸ : 5053
±ÛÁÖ¼Ò :
                                
Ãâó : http://blogs.msdn.com/b/taylorb/archive/2008/07/29/hyper-v-wmi-creating-a-thumbnail-image.aspx


### GET-VMThubnail.ps1
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") 

$HyperVParent = "localhost"   # hostnetwork
$HyperVGuest = "VMNAME" 
$ImagePath = "c:\Temp" 
$xRes = 640 
$yRes = 480 


$VMManagementService = Get-WmiObject -class "Msvm_VirtualSystemManagementService" -namespace "root\virtualization" -ComputerName $HyperVParent 
$Vm = Get-WmiObject -Namespace "root\virtualization" -ComputerName $HyperVParent -Query "Select * From Msvm_ComputerSystem Where ElementName='$HyperVGuest'" 
$VMSettingData = Get-WmiObject -Namespace "root\virtualization" -Query "Associators of {$Vm} Where ResultClass=Msvm_VirtualSystemSettingData AssocClass=Msvm_SettingsDefineState" -ComputerName $HyperVParent 
$RawImageData = $VMManagementService.GetVirtualSystemThumbnailImage($VMSettingData, "$xRes", "$yRes") #| ProcessWMIJob $VMManagementService.PSBase.ClassPath "GetVirtualSystemThumbnailImage" 

$VMThumbnail = new-object System.Drawing.Bitmap($xRes, $yRes, [System.Drawing.Imaging.PixelFormat]::Format16bppRgb565) 

$rectangle = new-object System.Drawing.Rectangle(0,0,$xRes,$yRes) 
[System.Drawing.Imaging.BitmapData] $VMThumbnailBitmapData = $VMThumbnail.LockBits($rectangle, [System.Drawing.Imaging.ImageLockMode]::WriteOnly, [System.Drawing.Imaging.PixelFormat]::Format16bppRgb565) 
[System.Runtime.InteropServices.marshal]::Copy($RawImageData.ImageData, 0, $VMThumbnailBitmapData.Scan0, $xRes*$yRes*2) 
$VMThumbnail.UnlockBits($VMThumbnailBitmapData); 

$VMThumbnail 
$VMThumbnail.Save("$ImagePath\$HyperVGuest.jpg")
 
 
 
ÀúÀåÆÄÀÏ
 
 
ĸóÀ̹ÌÁö



À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.