Kommentar
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
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