Home Data Center Microsoft: Controlling the mouse on a virtual machine

Microsoft: Controlling the mouse on a virtual machine

0
Microsoft: Controlling the mouse on a virtual machine
0


Continuing on my series of how to automate virtual machines – you can also script the mouse on a virtual machine.  Take a look at this chunk of code:

$VMName = “Windows 10 Enterprise”
$VMCS = Get-WmiObject -Namespace rootvirtualizationv2 -Class Msvm_ComputerSystem -Filter “ElementName=’$($VMName)’”
$mouse = $VMCS.GetRelated(“Msvm_SyntheticMouse”)
$mouse.SetAbsolutePosition(300,450) | out-null
$mouse.ClickButton(2) | out-null

What this PowerShell code does is:

  • Get the WMI object for the virtual machine
  • Get the mouse for the virtual machine
  • Set the mouse position to 300,450
  • Click the second mouse button

Interesting piece of information here: Hyper-V emulates a mouse with 5 buttons.

Cheers,
Ben



Read the entire article here, Controlling the mouse on a virtual machine

via the fine folks at Microsoft.

Categories:
Microsoft Founded in 1975, Microsoft (Nasdaq “MSFT”) is the worldwide leader in software, services, devices and solutions that help people and businesses realize their full potential.

Featured Resources:

Related Articles:

| LATEST FEATURED RESOURCES

White Papers

    Application Lifecycle Management with Stratusphere UX – White Paper

    Enterprises today are faced with many challenges, and among those at the top of the list is the struggle surrounding the design, deployment, management and operations that support desktop applications. The demand for applications is increasing at an exponential rate, and organizations are being forced to consider platforms beyond physical, virtual and cloud-based environments. Users […]

    Downloads

      Download Commvault VM Backup and Recovery: end-to-end VM backup, recovery and cloud management

      Commvault’s ability to provide end-to-end VM backup, recovery and cloud management creates a significantly better way to build, protect and optimize VMs throughout their lifecycle. Our best-in-class software for VM backup, recovery and cloud management delivers a number of significant benefits, including: VM recovery with live recovery options; backup to and in the cloud; custom-fit […]

      On-Demand Webinars

        What’s Going on in EUC Printing – A Technical Deep Dive!

        The IGEL Community and ThinPrint invite you to watch the following technical deep dive webinar. The agenda is to technically bring you up to speed on what’s going on in the EUC Printing space today along with a deep dive into new methods, technologies, printing scenarios and a discussion on why printing still matters. You […]

        Latest Videos

          Views All IT News on DABCC.com
          Views All IT Videos on DABCC.com
          Win big $$, visit ITBaller.com for more info!

          Visit Our Sponsors

          Close