Take a screenshot of a Hyper-V virtual machine guest using WMI and Invoke-CimMethod
Using the CIM cmdlets it's possible to take a screenshot of a virtual machine with the GetVirtualSystemThumbnailImage method. This needs to be run on the Hyper-V host as a user with Administrator rights. $managementService = Get-CimInstance -Namespace "root\virtualization\v2" -ClassName "Msvm_VirtualSystemManagementService" ; $vm = Get-CimInstance -Namespace "root\virtualization\v2" -ClassName "Msvm_ComputerSystem" -Filter "Name=' $VirtualMachineIdentifier '"; $videoHead = Get-CimAssociatedInstance -ResultClassName "Msvm_VideoHead" -InputObject $ vm ; $xResolution = $videoHead . CurrentHorizontalResolution; $yResolution = $videoHead . CurrentVerticalResolution; $result = Invoke-CimMethod -MethodName "GetVirtualSystemThumbnailImage" -InputObject $managementService -Arguments @{ TargetSystem = $ vm ; WidthPixels = $xResolution ; HeightPixels = $yResolution }; The dat...