Scaling out PowerShell with PowerShell Direct

I have spent a bunch of time this week working on various demos for Ignite in Atlanta.  While building these demos I have been heavily using PowerShell Direct to orchestrate large sets of virtual machines. A common pattern that I encounter is that I will write one piece of code – and then want to… Read more

Script to Inventory VM Guest OSes – Updated

The other day a colleague asked me how to use PowerShell to gather information about what operating system was running inside of each virtual machine on a Hyper-V server.  I went to point them to this blog post: Scripts to Inventory Virtual Machines [Hyper-V].  But then realized that there were two problems: This script uses… Read more

Windows – Read me that virtual machine

After a couple of weeks of playing around with Hyper-V APIs for reading virtual machine screens and sending keystrokes – I hit upon an interesting idea.  What would it take to make a “virtual machine screen reader”? You see, Windows itself has great support for a number of accessibility options.  And these work both in… Read more

Find a bitmap on the VM screen

Continuing with my series on how to do interesting automation stuff with Hyper-V – today I want to show you how to use PowerShell and the AForge.NET library to locate a bitmap on a virtual machine screen. For example – imagine that I had a test running in a Windows Server Core 2016 virtual machine:… Read more

Reading a pixel on a VM Screen

Two weeks ago I provided a code sample that allowed you to capture a Hyper-V virtual machine screen to a bitmap.  As part of this script – the virtual machine screen is stored in a Windows bitmap object.  There are actually a number of interesting things you can do with this object. On such thing… Read more

Copy files over PowerShell Direct (and more)

We recently updated a number of the capabilities of PowerShell Direct.  In Windows 10 Insider builds greater than 14280, and in Windows Server 2016, you can now create persistent PowerShell sessions using PowerShell Direct. The format for doing this is: $PSSession = New-PSSession -VMName <VMName> -Credential (Get-Credential) You can then use this session for a… Read more

Virtual Holograms

As opposed to real holograms? Anyway, semantic issues aside, this is something that I am really excited about.  About two weeks ago we announced the availability of the Hololens Emulator.  This allows you to begin developing holographic applications today – even if you do not have access to a Hololens device.  When you get it… Read more

Making and tuning a “safe automated mouse click”

Over the last week I have been talking about the components needed to automate the mouse in Hyper-V.  This is because I have been working on some automation scripts for my environment.  One problem that I have encountered is this: I will have a virtual machine that is being controlled by one of my scripts. … Read more

Checking the mouse button state in Hyper-V

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… Read more