This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$VMName = "VM 1" | |
$BMPName = "C:\Users\benja\Desktop\test.bmp" | |
Add-Type -AssemblyName "System.Drawing" | |
$VMCS = Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_ComputerSystem -Filter "ElementName='$($VMName)'" | |
# Get the resolution of the screen at the moment | |
$video = $VMCS.GetRelated("Msvm_VideoHead") | |
$xResolution = $video.CurrentHorizontalResolution[0] |