How to Use Hyper-V PowerShell Direct To Connect To A Virtual Machine

How to Use Hyper-V PowerShell Direct To Connect To A Virtual Machine

 

In his blog post, I’ll show you How to Use Hyper-V PowerShell Direct To Connect To A Virtual Machine without Network Connection or even network NIC.

PowerShell Direct gives us a new option or method to connect to a Virtual Machine from the Hypervisor Operating system easily without worrying about IP Address, security system Rules, Remote Management permission, etc.

The only requirements that you should meet are:

  • You should know the local administrator account on the VM guest
  • You must run the PowerShell Direct session when you logged on as an administrator on the Hyper-V host
  • the host should run Windows 10 or Windows 2016 Hyper-V version.

Below, I’ll show you how I connect to a local Virtual Machine running on my Host called Winnano2016.

Please note that I’m using the Enter-PSsession cmdlet with -VMName switch which Is one of many connection options available with the cmdlet.

Enter-PSSession -VMName WinNao2106

Next, I’ll be asked to provide the local administrator account of the local Admin account

How to Use Hyper-V PowerShell Direct To Connect To A Virtual Machine
How to Use Hyper-V PowerShell Direct To Connect To A Virtual Machine

As you can see below, When I type ipconfig the Server shows no configuration at all

How to Use Hyper-V PowerShell Direct To Connect To A Virtual Machine
How to Use Hyper-V PowerShell Direct To Connect To A Virtual Machine

When you are done with the configuration of your Virtual Machine, you should use the Exit-PSsession cmdlet to disconnect from the PowerShell Direct Session.

PowerShell Direct was first announced at Microsoft Ignite 2015 during the early beta releases of Windows Server 2016 Hyper-V builds and since became one of the best Hyper-V features.

I could also, run commands using the Invoke-Command cmdlet, which Issue cmdlets or script block on a remote computer.

Below, I’m running a GET-DATE cmdlet on the Virtual Machine WInNano2016

Invoke-Command -VMName winnano2016 -ScriptBlock {get-date }




Search blogs




Bitnami