Powershell Direct is the new cool feature that came along with Windows 10 and Windows Server 2016 ( Since Technical Preview ). It enables you to run arbitrary PowerShell in a Windows 10 or Windows Server VM Guest directly from your Hyper-V host without worrying about the network configuration or remote management settings.
Operating system requirements:
- Host: Windows 10, Windows Server Technical Preview 2, or later running Hyper-V.
- Guest/Virtual Machine: Windows 10, Windows Server Technical Preview 2, or later.
To connect and manage a VM-Guest using Powershell Direct, just do the following :
1. Open an elevated Powershell Prompt.
2. Find the VM Guest Name that you wish to connect to, execute “Get-VM | Select Name”. Note down the name of the VM.
3. Execute New-PSSession -VMName “nameofthevm” -Credential “username” .
4. To exit the connected session, execute “Exit-PSSession”.
What else can you do with Powershell Direct? You can Invoke commands or execute scripts ( Invoke-Command ) or even copy files ( Copy-Item )!