Virtual Machine Management using PowerShell Direct

Since Windows PowerShell version 5, Microsoft has implemented a new way to directly manage your virtual machines without network connectivity. PowerShell Direct has been introduced in Windows Server 2016 and Windows 10 version. it allows you to create a remoting session without any network connectivity from:

  • Windows 10 Hyper-V host
  • or Windows Server 2016 Hyper-V host

to

  • Windows 10 virtual machine
  • or Windows Server 2016 virtual machine

Basically, this is the same syntax as a PowerShell session, with the only difference that the -VMName parameter is used instead of –ComputerName parameter. Below is an example:

PS > Enter-PSSession –VMId 31d787fe-02cd-4363-b50b-16bc8243fc77

This method allows you to log on to the VM and thus run several commands without network connectivity. Of course, you need to be logged on to the Hyper-V host that hosts the virtual machine that you want to manage!

Now, I disable the network adapter and try to log on the VM without PowerShell Direct, I get an error message:

More information about the Hyper-V architecture here: Hyper-V Architecture

 

Thanks for reading! You can follow me on Twitter @PrigentNico

About Nicolas 282 Articles
I work as an IT Production Manager, based in Paris (France) with a primary focus on Microsoft technologies. I have 10 years experience in administering Windows Servers. . I am a Microsoft MVP for Cloud & Datacenter Management. I also received the PowerShell Hero 2016 award by PowerShell.0rg. And finally, I am "MCSE: Cloud Platform and Infrastructure", "MCSA: Windows Servers", "Administering & Deploying SCCM", and CheckPoint CCSA certified.