Last updated by at .

  • Microsoft Azure
  • Virtual Machine Manager

Tag: Windows Server 8

Upgrade Windows 8 Customer Preview to Windows 8 Release Preview ;-)

Windows 8 Upgrade

For those who are going to install the Windows 8 Release Preview. You cannot upgrade from Windows 8 Customer Preview. Same for the Windows Server 8 beta to Windows Server 2012 Release Candidate.



Windows Server 2012 Hyper-V: Convert VHD to VHDX

VHDX

With Windows Server 2012 Microsoft released a new Virtual Disk Format called VHDX. VHDX improves the Virtual Disk in a lot of way.

Back in October I wrote a blog post on the improvements of the VHDX Format in the Windows Server 8 Developer Preview. Back then VHDX supported a size of 16TB, with the release of the Windows Server 8 Beta (Windows Server 2012 beta) the new Maximum size changed to 64TB.

Some of the VHDX improvements:

  • Support up to 64TB size
  • Supports larger block file size
  • improved performance
  • improved corruption resistance
  • the possibility to add meta data

You can download the VHDX Format Specification.

To use this new features you have to convert your existing VHDs into the new VHDX format. You can this do in two different ways, with the Hyper-V Manager or with Windows PowerShell.

Convert VHD to VHDX via Windows PowerShell

To convert a VHD to a VHDX with Windows PowerShell you can use simple this PowerShell command:

Of course you can convert the VHDX back to a VHD using the following command:

Convert VHD to VHDX via PowerShell

Convert VHD to VHDX via Hyper-V Manager

  1. Start the Hyper-V Manager and click on “Edit Disk…
    Hyper-V Manager
  2. Now select the VHD you want to convert
    Edit Virtual Hard Disk
  3. Select “Convert
    Convert Virtual Hard Disk
  4. Select the target format in this case VHDX
    Convert VHD to VHDX
  5. Select the new location for your new VHDX
    Convert VHD to VHDX Location
  6. Check the summary and click finish
    Convert VHD to VHDX Finish

 

Same as with the PowerShell command, you can also convert a VHDX to a VHD. But you have to make sure that the VHDX is not bigger than 2TB.

Aviraj Ajgekar already did a post on this TechNet blog about how you can convert a VHD to VHDX via Hyper-V Manager.

 



Windows Server 2012 – Add and Remove GUI

Windows Server 8

Microsoft worked hard on the management of the new Windows Server 2012. In Windows Server 2008 R2 you had to choose during the Installation if the Server is a Windows Server Full Installation (with GUI) or a Windows Server Core Installation (without GUI). In Windows Server 2012 you can add and remove the GUI from the server.

Add GUI on a Core Server

On a Core Server you can add the with the following PowerShell command

add-windowsfeature server-gui-shell

After the Installation you have to restart the server

AddGUIPowershell

Remove GUI on a Server

There are two ways you could do that, first via Server Manager remote the GUI feature:

RemoveGUI

Or via Windows PowerShell

Remove GUI with Powershell

It is also important that you understand that Windows Server 2012 has three different GUI options.

  • Core
  • GUI
  • GUI with Management Tools

So if you activate the GUI you do not get all of the Management tools automatically. You have also to activate the “Management tools GUI”.



Configure Hyper-V Host Network Adapters Like A Boss

Hyper-V R2 SP1

If you are working a lot with Hyper-V and Hyper-V Clustering you know that something that takes a lot of time is configure the Hyper-V Host Network Adapters. First because most of the time you have a lot of NICs build into your host for the different Hyper-V and Cluster networks and secondly Windows names the NICs in a random way and this makes it hard to find out which network card is the right one. Maybe your first NIC on your Hyper-V Host01 is called “Local Area Connection 2″ and on your second Hyper-V Host with the same hardware configuration the “same” NIC is called “Local Area Connection 3″. One of the possibilities to find out which network card is the right one is to check the MAC address of the network adapter. But for this you still have to know which MAC address is on which network adapter port.

Another way to do it is to plug in the network cables one by one. So you can see which port is active and then you can rename the network adapter. Now some times this one is one of the only solutions, but it takes a lot of time to do this on every host. And if you build Clusters up to 16 Hosts you really don’t want to do that.

Now there is a solution, you can sort your NICs by PCI bus and PCI slot. Maarten Wijsman did a blog post how you can do this on the Hyper-V.nu blog. With this knowledge you can start to automate this very easy.

networkcable

I have created two Windows PowerShell scripts which make my life a lot easier.

First I configured the first Hyper-V host and renamed all the Network adapters. If you have a GUI server you could do that via GUI or if you have a Windows Server Core or Hyper-V Server you can do this via netsh.

If I have done that I use my  Windows PowerShell script called Get-NICInformation.ps1 to get the information about the network adapters.

get-nicinformation

This gives me a lot of information about the NICs in my first hosts. But the important part is the order of the NICs. In my example I know that the order is this:

  • Management
  • VMNet
  • CSV
  • LiveMigration
  • iSCSI01
  • iSCSI02

Since my other hosts have the same hardware they will have the same PCI Bus order.

For the next step I go to my second host. There I have my other Windows PowerShell script (Set-IPAddressfromXML) and a XML file (networkconfig.xml).

dir

I edit the networkconfig.xml file with the correct network information. Important here are the id=”” parameters. They are showing the order of the NICs so with Get-NICInformation I can see the Management interface is the first one, so it gets id=”1″, VMNET is the second one it gets id=”2″ and so on. You also set the correct IP Address information for the second host. Most of the time you just have to change the last number.

You can also set non static IP Addresses (DHCP), in my case I did this for the VMNET adapter which will be used by the Hyper-V Virtual Switch and does not need a IP address.

networkconfigxml

After you have done this, you can now simply run the Set-IPAddressfromXML script. This will use the Information from the networkconfig.xml file and will rename all network adapters and will set the correct IP addresses.

set-ipaddressfromxml

 

I can now copy the Set-IPAddressfromXML.ps1 and the networkconfig.xml to each Hyper-V hosts and edit the IP Addresses in the xml file, run the PowerShell file and I am done.

Lets recap:

  1. Rename the NICs of the first hosts
  2. Run the Get-NICInformation.ps1 on the first host and check the NIC order
  3. Edit the networkconfig.xml on the second hosts with the right order of the NICs
  4. Run the Set-IPAddressfromXML.ps1
  5. Do this for all Hyper-V Hosts.

I hope this will make life easier :)

You can download the Scripts from my Skydrive

Some other things:

  • I have tested this with Windows Server 2008 R2, Hyper-V Server R2, Windows Server 8 beta, Hyper-V Server 8 beta
  • It works for both because it’s not done with PowerShell v3, maybe I will update it to get it even better.
  • I do not support this script, and you are running it on your own risk.


Windows Server 2012: Hyper-V Snapshot Reminder

Windows Server 8

Last year I created a Windows PowerShell script for System Center Virtual Machine Manager which checks all the Virtual Machines for Snapshots and if you have any it will send you an E-Mail and it will remind you about that.
It were just some small changes from the SCVMM PowerShell cmdlets to the Windows Server 2012 PowerShell cmdlets.

Hyper-V Snapshots Reminder



Windows Server 2012: Doing multiple configuration changes on Hyper-V VMs via PowerShell

Windows Server 8

Over the weekend I was Setting up my lab for the RTM of System Center 2012. I created some Windows Server 2008 R2 Virtual Machines on my Windows Server 2012 beta Hyper-V server. After I had created all VMs and installed them, I realized I forgot to configure the limit for Dynamic Memory for the Hyper-V Virtual Machines.

Now here the new PowerShell module for Hyper-V which comes with Windows Server 2012 helped me save some time.

Hyper-V PowerShell

 

First I check the Dynamic Memory Maximum value for all my System Center 2012 Virtual Machines.

After that I changed the value from all my System Center 2012 Virtual Machines to 8GB

btw. if you don’t know that 8GB are 8589934592 Bytes PowerShell can help you, check this out:

Windows Server 2012: Hyper-V PowerShell

Ben Armstrong, Virtualization Program Manager, did also a blog post on performing bulk configuration changes in Hyper-V via Windows PowerShell on his blog.

 



Windows Server 2012 – CDN (Consistent Device Naming)

Windows Server 8

There is a new feature coming with Windows Server 8 called Consistent Device Naming (CDN) which should make life in the datacenter a lot easier.

CDN

It allows to hardware vendors to consistently name NICs in the BIOS which means the Windows Server 8 can read this information and name NICs the same.

That means that the name of the NICs on the chassis can be the same name on the NICs in the OS.

CDN  Consistent Device Naming

If you have ever worked with Hyper-V Clusters you are going love this feature.