Lock the VM Console when you close Hyper-V UI

There is a little feature that we snuck into Hyper-V recently that is very handy for our security minded users out there.  Normally, if you connect to a virtual machine with Remote Desktop or Enhanced Mode VM Connect, when you close the desktop you know that the next user to connect will have to provide user credentials.

However, if you are using basic mode VM Connect - then it is possible that the next user to connect will be able to jump straight in and use your credentials if you do not remember to manually log out of the virtual machine.  Luckily - this problem can now be avoided.  If you open up PowerShell and run:

 set-vm "Windows 10 Enterprise" -LockOnDisconnect On

We will automatically lock the guest operating system session when you close VM Connect.

Cheers,
Ben

Comments

  • Anonymous
    June 02, 2016
    Is there a VMBus signal that we can look for in Linux VM's ?
  • Anonymous
    June 03, 2016
    I noticed the VM needs to be rebooted for this to take effect.It's more convenient to have it active without taking the service down.Thanks!
  • Anonymous
    June 05, 2016
    Where should I run this command either from Hyper-V Host or from Guest-VMI am getting "A parameter cannot be found that matches parameter name 'LockOnDisconnect'" when I run it from Hyper-V HostPlease suggest where I am wrong
  • Anonymous
    June 06, 2016
    LockOnDisconnect, I have never thought of that. I have been logging of manually before disconnecting for a long time!
  • Anonymous
    June 08, 2016
    @Satheeskumar,This command should be run on the Hyper-V host.Are you using Windows Server 2016 Technical Preview 4 or later?It's available in Windows 10 Version 1511 as well.