Category Archives: HyperV

How to rapidly create a Virtual Machine from WIM or ISO (WIM2VHD)

If you have DVD media or and ISO of your Operating System, you can quickly and easily create a sysprepped VHD or VHDX image. With this Virtual Hard Disk file, you can set up a Virtual Machine and boot it directly to the Out of Box Experience, thus saving about half an hour to an hour of installation time.

The process for doing this and PowerShell script called Convert-WindowsImage.ps1 is documented in the Technet Script Repository here – http://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f

Note: This latest release (v6.3) now supports the creation on Generation 2 VMs.

Windows Server 2012 R2 Hyper-V Component Architecture Poster and Hyper-V Mini-Posters

Microsoft have released a bunch of new visual guides to the various features of Windows Server 2012 R2. As per the Microsoft description “These posters provide a visual reference for understanding key Hyper-V technologies in Windows Server 2012 R2. They focus on Generation 2 virtual machines, Hyper-V with virtual hard disk sharing, online virtual hard disk resizing, storage quality-of-service, enhanced session mode, live migration, Hyper-V failover clustering, and upgrading your private cloud. This visual reference is available as a complete wall poster or as individual components that are suitable for printing on most standard printers.”

The link to download these posters is here – http://www.microsoft.com/en-us/download/details.aspx?id=40732

How to create Self-Signed Certificates for Hyper-V Replication

Here is the quick and simple lowdown on how to create Self-Signed SSL Certificates for use in Hyper-V Replication. There is a great article on Technet which gives more background into this process – http://blogs.technet.com/b/virtualization/archive/2013/04/13/hyper-v-replica-certificate-based-authentication-makecert.aspx

You will need Makecert.EXE which can be found from http://msdn.microsoft.com/en-us/library/bfsktky3.aspx or here – http://msdn.microsoft.com/en-us/library/windows/desktop/aa386968(v=vs.85).aspx

On the First Server, in an elevated command prompt.

  1. Run makecert -pe -n “CN=FirstRootCA” -ss root -sr LocalMachine -sky signature -r “FirstRootCA.cer”
  2. Run makecert -pe -n “CN=[FQDN1]” -ss my -sr LocalMachine -sky exchange -eku 1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2 -in “FirstRootCA” -is root -ir LocalMachine -sp “Microsoft RSA SChannel Cryptographic Provider” -sy 12 FirstServer.cer
  3. Copy SecondRootCA.cer from Second Hyper-V
  4. Run certutil -addstore -f Root “SecondRootCA.cer”
  5. Run reg add “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Replication” /v DisableCertRevocationCheck /d 1 /t REG_DWORD /f

On the Second Server, in an elevated command prompt.

  1. Run makecert -pe -n “CN=SecondRootCA” -ss root -sr LocalMachine -sky signature -r “SecondRootCA.cer”
  2. Run makecert -pe -n “CN=[FQDN2]” -ss my -sr LocalMachine -sky exchange -eku 1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2 -in “SecondRootCA” -is root -ir LocalMachine -sp “Microsoft RSA SChannel Cryptographic Provider” -sy 12 SecondServer.cer
  3. Copy FirstRootCA.cer from First Hyper-V
  4. Run certutil -addstore -f Root “FirstRootCA.cer”
  5. Run reg add “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Replication” /v DisableCertRevocationCheck /d 1 /t REG_DWORD /f

Then you can use these certificates in Hyper-V replication. The steps to setting this up can be found here – http://blog.powerbiz.net.au/hyperv/hyper-v-replica-for-small-business/

Hyper-V disaster recovery to different hardware

It is not a scenario you want to see as a system administrator, especially in a small business, where there is only one physical server. This afternoon, the one physical server in a client’s office “laid down to rest.” Lesson One
– Do not let you servers live past their warranty date. This server was two weeks away from being replaced, after running 24×7 for almost five years.

Lesson Two
– Have a recovery plan and a secondary recovery plan. I scrambled to locate a spare server on a Saturday evening. Putting together bits and pieces, I was able to build up a reasonable temporary server. I then followed the usual recovery process and stared at the screen when it told me it would take 15 hours to restore the C: volume. There was still a D: and E: volume with much more data to recover.

So, I pulled the old server apart, and pulled out the two 4-bay drive cages, along with the RAID controller, and inserted it into temporary server #2. All the drives were intact, so I was able to copy the virtual machines directly off the old server hard drives. This only took 1 hour.

A really cool feature in Windows Server 2012 Hyper-V is the ability to perform an in place import. The process is quick and simple. Click on the Import Virtual Machine link on the right column of the Hyper-V Manager. This will begin the Import Virtual Machine Wizard.

After the wizard is complete, you can make changes as needed to the VM. NOTE: If you are recovering the VM to a host with a different processor platform, you need to enable the processor compatibility option in the VM Settings.

Finally, you click Start to boot up the recovered VM and straight away, you run into a major block.

The import wizard does not set the permissions on the imported files to allow the system to access the necessary files. To set these permissions, use the icacls command in the same manner as documented here – http://blog.powerbiz.net.au/fixes/hyper-v-virtual-machines-may-not-start-and-you-receive-an-error-%e2%80%98general-access-denied-error%e2%80%99/ . To save time, if you have already read that blog post, here is the command – icacls [VHD file] /grant “NT VIRTUAL MACHINE\[VM SID]”:F

There are at least 4 files that you need to reset permissions for.

  1. The hard drive(s) that are attached to this VM.
  2. The XML file with the SID that you need to use in the icacls command line. This file found in the [SERVERNAME]\Virtual Machines folder.

     

  3. The two BIN and VSV files that are located in the [SERVERNAME]\Virtual Machines\[SID] folder.

Once these permissions are set, you will be able to start up the recovered VM.

 

Windows Server 2012 R2 – What’s in it for the SMB?

Microsoft introduced the next generation of their solutions at TechEd North America 2013 today. It was no surprise that much of the offerins were targeted towards large enterprise and cloud computing, as this is where the company is firmly focussed at the present. You can read the official press release here – http://www.microsoft.com/en-us/news/Press/2013/jun13/06-03TechEd13PR.aspx

So, what is in it for the traditional small and micro business? Office 365 currently offers a good alternative to running your own email server on premises after  the Small Business Server line up was discontinued. Wave 15 of Office 365 continues this with infrastructure built upon the Server 2013 family of products. However, Microsoft announced a further release of their server operating system named Windows Server 2012 R2. In this new release, there are a number of features that will be really beneficial to the small and micro business.

Windows Server. A host of new features were announced here. Among the main SMB friendly features are performance improvements, support for dynamic memory and dynamic disks in Linux virtual machines, Drag and drop live migrations, enhanced Remote Desktop experience, and better VM debugging and management. Storage Space has been given an overhaul, and this is a good to to re-evaluate this new technology and see how it can be beneficial to the SMB market. Work Folders encrypts and replicates user data between file servers and devices, and allows for remote wipe of corporate data.

Windows Server Essentials. This final legacy of the Small Business Server has now been completely integrated into the Windows Server 2012 R2 product. Whilst it can still be installed as Windows Sever 2012 R2 Essentials, it can now also be installed as a role in Windows Server 2012 R2 Standard and Datacentre.

Hyper-V new Features. A whole host of new changes have been incorporated into Windows Sevrer 2012 R2 Hyper-V. First, there is a new VM standard called generation of virtual machines which run only as VMs. They are UEFI based and can only run Windows 8, Windows 2012 or higher operating systems, and do not support legacy devices. VHDx files can now be resized online. USB passthrough is now implemented. Hyper-V Replica has now been extended to allow a target VM to be replicated on to another target  amd there are now choices for the replication intervals.

You can find out about these new developments as they are announced via the live North America TechEd 2013 streaming and videos here – http://channel9.msdn.com/

 

 

 

How to Turn off Printer Redirection for Remote Desktop Sessions on a Hyper-V Server Host

If you use Remote Desktop Services to connect to your Windows Server 2012 Hyper-V Host, one of the best practices tasks that you can do is to turn off printer redirection. Printer Redirection is the feature that allows a local printer to be mapped on a remote machine, and allows printing across the network or Internet. Sometimes, badly written drivers can cause issues on the remote host when redirection is permitted, causing major issues on the server, and potentially causing downtime.

Therefore, it is best to turn off this redirection as a precaution. This process can be performed on Windows Server 2008 R2 and Windows Server 2012.

  1. Open an Administrative Command Prompt, and Start the Microsoft Management Console (MMC).

     

  2. In the Console, navigate to Add/Remove Snap-in

     

  3. Select and add the Group Policy Object snap-in.

     

  4. Click Finish to apply the Snap-in to the Local Computer.

     

  5. Click OK, to close the Snap-In window.

     

  6. Expand the Snap-in to Console Root/Local Computer Policy/Computer Configuration/Administrative Templates/Windows Components/Remote Desktop Services/Remote Desktop Session Host/Printer Redirection

     

  7. Double Click on “Do not allow client printer redirection” and Enable the setting. Click Apply, then OK.

     

  8. Log off the session to apply the setting.

Stop Windows Server 2012 and Windows 8 from automatically rebooting the server after logging in

One of the recent issues in managing Windows Server 2012 is the way Automatic Updates works by default. If automatic updates are installed on a server, it may or may not automatically reboot the server or PC.

At the log in screen, you may see this message.

Upon logging in, you may be faced with the prospect of the server rebooting in 15 minutes. The countdown timer has started and there is no apparent way to click on a “Postpone” button.

In many cases, this will cause some distress. Particularly if this is a Hyper-V host server, and you have an entire network of 120 users accessing the virtual machines!

Fortunately, there is a fix to prevent the server from counting down and restarting.

  1. Open an administrative command prompt.
  2. Type NET STOP WUAUSERV
    to stop the Windows Update service.

This will stop the Windows Update service, and stop the countdown timer until the server is restarted manually. Don’t forget to restart the server at the next possible opportunity.

Using Windows 8 Client Hyper-V

A new document has been released providing a quick overview of the HyperV technology that is built into Windows 8. This is similar to the Windows 7 functionality, which was called XP Mode.

The document is a basic overview of HyperV in Windows 8, how it could be used, that requirements are needed, and how to enable the feature. It also provides a nice lot of links to more information on Tools, and some PowerShell Cmdlets, and also discusses RemoteFX functionality.

The document can be downloaded here – http://www.microsoft.com/en-us/download/details.aspx?id=36188

 

Hyper-V Replica for Small Business

This post serves as a starting point for my series of posts on the new feature called Hyper-V Replica.

Windows Server 2012 HyperV Replica Scenarios for Small Business

http://blog.powerbiz.net.au/hyperv/windows-server-2012-hyperv-replica-scenarios-for-small-business/

In this post, I examine the various scenarios where a small business could use this technology.

 

How to set up Hyper-V Replica for Small Businesses

http://blog.powerbiz.net.au/hyperv/how-to-set-up-hyper-v-replica-for-small-businesses/

In this post, we look at how to configure and set up Hyper-V Replica.

The post continues on to a follow up session, “Disaster Recovery with Hyper-V Replica for Small Business on a Budgethttp://blog.powerbiz.net.au/hyperv/disaster-recovery-with-hyper-v-replica-for-small-business-on-a-budget/, which looks are a cheaper alternative in deploying this feature.

 

Monitoring and Managing Hyper-V Replica

http://blog.powerbiz.net.au/hyperv/monitoring-and-managing-hyper-v-replica/

We also look at how to monitor and manage the Hyper-V Replica and steps to take in case the replica is needed in a DR situation.

 

Supplementary Resources

There are a number of other posts that are referred to or provide further information related to the subject matter.

Monitoring and Managing Hyper-V Replica

In the previous posts, we have looked at scenarios for using Hyper-V Replica in the small business environment. We also looked at how to enable replication and configure this. Once it has been configured and is working, we need to be able to manage the environment and monitor the replication to ensure that there is integrity in the process.
In the post, we will examine the monitoring and management features and also look at testing the replica to ensure that the systems will failover if they are required.

Monitoring

The easiest way to check the status of the replication is to view the properties via the console.

Just right click on the VM that has a replica and Select Replica, View Replication Health. This can be done on the primary server or on the replica.

The Replication Health window will give you the following information:

  • Replication State
  • Replication Type (whether this is the primary or replica)
  • The Primary and Replica server names
  • The Replication Health Status (the usual Windows OK tick, warning, or critical notifications)
  • Statistics over the past number of hours since the past 9am processing run, including averages for size and latency, and any errors encountered
  • The last replication run
  • Status on Test failovers

This information can also be exported to a CSV file.

If you are Powershell inclined, you can view this information by using the Get-VMReplication command.

There are also Performance Monitor counters available for monitoring.

And of course, there are events to be monitored in the Event Logs.

Obviously, with such information available, it is possible to script and enable reporting on this information.

Management

There are a few things that you can do with a VM Replica, which are shown on the Replication choice on the VM on the Replica Server.

On the Primary server, there are only 4 options. The last 3 are the same on both servers. On the primary server, there is no option to Test failover, since the replica physically resides on the replica server only. Planned failover does the same thing as Failover on the replica server.

  1. Failover

    If a problem occurs at the primary VM, then there are some decisions to be made. If the issue is going to be a short outage (ie. A power failure), it may be best to wait out the outage, rather than put the failover in place. This is because of the overheads in performing a failover and restoring back from a failover are probably going to take longer. However, if the power will be cut for 4 hours, and the business needs to be operational, then a failover to the replica would be a good option.

    To perform a failover, the primary VM must be offline. Select the recovery point to return the VM state to (or choose the last one selected). Then click the Fail Over button.

     

    If the primary VM is still online, you will get an error.

     

    The Replica VM will start immediately. Once it has started up, you will need to reset IP addresses, as the NIC hardware will be different. In most cases, not much else will need to change. It will look as though the VM is running with a snapshot (In fact, it is!).

     

    Now, the management choices have changed on the Replication section.

     

    There are 5 options when a VM is in failover mode.

    1. Reverse Replication. This option completes the failover by reversing the replication direction. The reverse replication wizard will start up, which takes you through the same steps as setting up a new replication. The current running replica will now become the primary VM, while the VM at the primary will be removed and a new replica will be created. Initial replication will be performed in the reverse direction.
    2. Remove Replication Points. This option completes the failover by making the VM a primary VM. Replication will stop and the smapshot will be merged into the VM. After this, the only options to continue are to reverse the replication (from the replica) or cancel replication (on both servers).
    3. Cancel Failover. This will cancel the failover, and revert changes back to the original primary VM.
    4. View Replication Health. The replication health status will be displayed here with various errors, since the replication is in failover mode.
    5. Remove Replication. This option will remove the replication connection between the two servers. This operation must be performed on both the primary and replica servers.

     

  2. Test Failover

    The Test Failover option creates a copy of the VM and allows you to turn on and run the VM in a test setting. This allows you to check that replication is working and that the VM will boot up without issues.

    Selecting Test Failover will bring up the options for the test. You can select the last recovery point or earlier points if they exist.

     

    A Test VM will be created with the NIC not connected. You could create an internal test Network and assign a NIC connection to boot up in an isolated situation to test the VM. You can perform any Hyper-V management functions on this test VM. Remove the VM when it is no longer required.

     

  3. Pause Replication.

    This option pauses the replication. To resume the replication, select Resume Replication.

     

  4. View Replication Health. This option has been discussed in the monitoring section above.
  5. Remove Replication. This option is self-explanatory. Note that the operation must be performed on both host servers.