What’s New in PowerShell For Hyper-V in Windows Server Technical Preview 1? #HyperV #PowerShell #vNext

3 Min. Read

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.

PoSh-12R2-TP1-01

As you can see we have 178 cmdlets, let’s do the same on Windows Server TP1:

PoSh-12R2-TP1-02

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

PoSh-12R2-TP1-03

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

PoSh-12R2-TP1-04

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.

PoSh-12R2-TP1-15

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.

PoSh-12R2-TP1-16

II- Get-VMVideo, Set-VMVideo

PoSh-12R2-TP1-08PoSh-12R2-TP1-05

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.

PoSh-12R2-TP1-12

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:

PoSh-12R2-TP1-14

Custom @ 1024X768

PoSh-12R2-TP1-13

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.

PoSh-12R2-TP1-15

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.

PoSh-12R2-TP1-16

I will update this blog post as soon as the next Technical Preview will come out Winking smile

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

Previous

What’s New In Altaro Hyper-V Backup V5? #Altaro #HyperV

Update Rollup 5 for System Center 2012 R2 is Now Available #SysCtr #SystemCenter

Next

Let me know what you think, or ask a question...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to Stay in Touch

Never miss out on your favorite posts and our latest announcements!

The content of this website is copyrighted from being plagiarized!

You can copy from the 'Code Blocks' in 'Black' by selecting the Code.

Please send your feedback to the author using this form for any 'Code' you like.

Thank you for visiting!