Notă
Accesul la această pagină necesită autorizare. Puteți încerca să vă conectați sau să modificați directoarele.
Accesul la această pagină necesită autorizare. Puteți încerca să modificați directoarele.
Continuing in my series on Hyper-V automation; as well as being able to get the position of the mouse cursor in the virtual machine - you can also check the mouse button state.
$VMName = "Windows 10 Enterprise"
$VMCS = Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_ComputerSystem -Filter "ElementName='$($VMName)'"
$mouse = $VMCS.GetRelated("Msvm_SyntheticMouse")
$mouse.GetButtonState(1).IsDown
$mouse.GetButtonState(2).IsDown
This PowerShell code returns information about whether the first or second mouse button is currently down or not.
Cheers,
Ben