Which Virtual Machine consoles are open?

Ever wonder which virtual machine consoles were open? I was working on an unrelated script the other day and stumbled on the ‘NumMksConnections’ property. It is a simple integer that appears to contain the number of open Mouse-Keyboard-Screen connections to a virtual machine. A simple PowerCLI one liner will show us all of the virtual machines with more than 0 open connections.

Get-View -viewtype virtualmachine | %{if ($_.RunTime.NumMksConnections -ne 0) {write-host $_.config.name has $_.RunTime.NumMksConnections console connection`(s`) open}}

I noticed a few other properties in RunTime that I’d like to try out. Question and ToolsInstallerMounted may be worth trying to throw in the next version of vCheck.

This entry was posted in Scripting, Virtualization. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Notify me of followup comments via e-mail. You can also subscribe without commenting.