Hello folks,
In October last year, Microsoft released Windows Server Technical Preview 1 bits along with System Center Technical Preview and Windows 10 Technical Preview.
On Friday evening January 3rd, 2015 Microsoft made the latest Windows 10 Technical Preview 2 available to the public. I see that 2015 will be an exciting year, however, the final release of Windows Server vNext and System Center is not until 2016!
In today’s blog post we will look at what’s new in PowerShell for Hyper-V in Windows Server 2016 Technical Preview 1.
The Hyper-V PowerShell module includes several significant features that extend its use, improve its usability, and allow you to control, automate and manage your Hyper-V environment.
Hyper-V in Windows Server 2012 R2 ships with 178 PowerShell cmdlets. These cmdlets allow a Hyper-V administrator to handle very simply, basic tasks to advanced ones such as setting up a Hyper-V replica for virtual machine disaster recovery.
If we look into PowerShell on Windows Server 2012 R2 and count the Hyper-V cmdlets that are available at our disposal.
As you can see we have 178 cmdlets, let’s do the same on Windows Server TP1:
As you can see we have 186 cmdlets in Hyper-V TP1 versus 178 in Hyper-V 2012 R2, so we have 8 new cmdlets so far.
What are these new cmdlets? Let’s compare the two modules side by side and explore the difference.
I will run the following cmdlets on a Hyper-V Technical Preview host:
Get-Command -Module Hyper-V | Export-Clixml C:\HyperV-TP1-Compare.xml Invoke-Command -Computer HyperV-12R2 -ScriptBlock {Get-Command -Module Hyper-V | Export-Clixml C:\HyperV-2012R2-Reference.xml} Copy-Item \\HyperV-12R2\C$\HyperV-2012R2-Reference.xml -Destination C:\ Diff -ReferenceObject (Import-Clixml C:\HyperV-2012R2-Reference.xml) -DifferenceObject (Import-Clixml C:\HyperV-TP1-Compare.xml) -Property Name
The result above will be a table telling you what’s different. Every PowerShell cmdlet that’s in the reference set (HyperV-2012R2-Reference.xml), but not in the difference set (HyperV-TP1-Compare.xml), will have a <= indicator (which indicates that the cmdlet is present only on the left side). However If a cmdlet is on the difference Hyper-V TP1 host but not on the reference 2012R2 host, it’ll have a => indicator which is our case here with 8 different cmdlets on the right side. Finally, PowerShell cmdlets that match across both sets won’t be included in the difference output.
All the previous PowerShell cmdlets that are available in Windows Server 2012 R2 Hyper-V are available as well in Windows Server Technical Preview in addition to the following:
Add-VMAssignableDevice Dismount-VMHostAssignableDevice Get-VMAssignableDevice Get-VMVideo Mount-VMHostAssignableDevice Remove-VMAssignableDevice Set-VMVideo Update-VMConfigurationVersion
Let’s deep dive and read the help for each of these new cmdlets.
I- Update-VMConfigurationVersion
Microsoft in Windows Server technical preview introduced a new configuration file format for Virtual Machines which is designed to increase the efficiency of reading and writing virtual machine configuration data. It is also designed to reduce the potential for data corruption in the event of a storage failure. The new configuration files use the .VMCX extension (Replaced the old .XML files) for virtual machine configuration data, and the .VMRS extension (Replaced the old .VSV/.BIN files) for VM runtime state data.
The upgrade process is only through PowerShell no UI!
Let’s see the updated VM configuration version in action.
To upgrade the VM Configuration File for a Virtual Machine, you need to turn off the VM first, and then from an elevated Windows PowerShell command prompt run the following:
Update-VMConfigurationVersion FS01
Let’s see now the difference after we update the configuration version for “FS01” Virtual Machine.
II- Get-VMVideo, Set-VMVideo
The Get-VMVideo and Set-VMVideo are used to modify the Synthetic Display Controller (Microsoft Hyper-V Video Resolution) for the virtual machine.
Let’s see how it works, first I will query the current Video settings for the VM.
As you can see the Horizontal and Vertical Resolution is set to default 1920 X 1200.
In order to change the display resolution, you need to turn off the VM first, then change the resolution type as shown in the above figure.
Let’s log in to the virtual machine now and see the difference before and after we changed the display resolution.
Default @ 1920X1200:
Custom @ 1024X768
As you can see the resolution settings are grayed out now, and cannot be changed, it’s fixed to 1024 X 768.
One important point to mention, that these settings will take effect only when you log in to the Virtual Machine without leveraging the Enhanced Session Mode feature that was introduced in Windows Server 2012 R2.
III- Get-VMAssignableDevice, Add-VMAssignableDevice, Remove-VMAssignableDevice
The Get-VMAssignableDevice, Add-VMAssignableDevice, and the Remove-AssignableDevice are probably used to assign devices for Virtual Machines by either the Instance ID or the Location Path.
IV- Mount-VMHostAssignableDevice, Dismount-VMHostAssignableDevice
The Mount-VMHostAssignableDevice, and Dismount-VMHostAssignableDevice are probably used to mount/dismount a device globally for the Hyper-V host, and this is by either the Instance ID or the Location Path as well.
However, the help file is not completed and no PowerShell examples are available yet.
I will update this blog post as soon as the next Technical Preview will come out
Note: This is the current release of the Technical Preview 9841 build, so we’ll have to wait and see the changes in the next bits…
Enjoy your day!
Cheers,
-Charbel