Windows Server 2016 TP4 – PowerShell Direct
Lately I've been spending a lot of time going through all the pieces of what makes Windows Server 2016 TP4 a great product. One of these gems I was playing with today is PowerShell Direct.
By the way, if you want to learn more quickly, watch the video below.
It’s really cool because as an ITPro for most of my career I’ve always liked solutions to be simple and convenient. It allows you to automate your hyper-v environment by scripting VM configuration and deployment where each VM needs different roles and requirements. You can even check the status or the guest OS and maybe avoid the dreaded
In order to manage VMs without accessing the console we had 3 choices (up to now)
- RSAT tools
- Remote PowerShell
- Remote Desktop
Those solution are fantastic, but you must setup the proper access ahead of using them. AND How many times have you used remote PowerShell to manage the VM networking settings and ended up accidently ensured that you could no longer connect to the VM in the process????
PowerShell Direct provides the scripting and automation experience available with remote PowerShell without having to configure anything.
- The host OS must run Windows 10, Windows Server Technical Preview, or a higher
- The VM must run Windows 10, Windows Server Technical Preview, or a higher.
And in order to create a PowerShell Direct session on a virtual machine,
- The virtual machine must be running locally on the host and booted.
- You must be logged into the host computer as a Hyper-V administrator.
- You must supply valid user credentials for the virtual machine.
You can connect to a VM. On the Hyper-V host as administrator run PowerShell use following command:
Enter-PSSession -VMName <VMName>
Enter-PSSession -VMGUID <VMGUID>
After you provide proper credentials you will notice the prompt will change to identify the VM you are connected to.
From there you can use any PowerShell command to configure the VM. Making the configuration of that VM very straight forward.