Friday, May 17, 2013

V2V or P2V failed state and cannot remove VM

Recently I was working with a customer on a VMware to Hyper-V migration. We were leveraging the great inbuilt V2V tool that is part of Virtual Machine Manager 2012. At some point during the virtual-to-virtual conversion the process failed.

After the conversion failed the VM was listed in Virtual Machine as 'Virtual-to-virtual conversion failed'. I decided to clean up the vm and restart the process.
- I tried to delete the VM with no luck.
- I then tried to repair the VM and this also failed as well.

Repairing in the past generally resolves a "stuck" VM. As a result I had to follow the below procedure to clear the error message and allow the VM to be deleted.

Please note this procedure is not a Microsoft official supported procedure and should be carried out with caution (make sure you take a backup of the VMM Datbase):

Backup the VMM 2012 Database:
1. Launch the Virtual Machine Manager Console and go to the 'Settings' view. In the settings view click 'Backup'.





















Edit the relevant table in the VMM Database:
1. Launch SQL Management Studio. Expand the 'VirtualManagerDB' database.




 

2. Expand 'Tables' and scroll down and find 'dbo.tbl_WLC_VObject'.














3. Edit the table and search for the "stuck" VM.

4. We then want to find the 'ObjectState' column for that VM and change the value to '1' and press Enter.
 





















5. In Virtual Machine Manage refresh the Cluster.

6. After the Cluster refreshes the VM can now be deleted.

Check Hyper-V Integration Services Versions

Ensuring that all your hosts have Integration Services Installed and are all the same version is important to keep your Hyper-V environment in a optimal/stable state.

I use the following PowerShell command to list all VM's and associated Integration Services version on a Hyper-V host:
Get-VM | ft Name, IntegrationServicesVersion

I use the following PowerShell command to list all VM's and associated Integration Services version on a entire cluster:
Get-ClusterGroup | Get-VM | ft Name, IntegrationServicesVersion

Hyper-V 2012 Best Practices

I came across a great article on Hyper-V 2012 Best Practices, written by a Microsoft Premier Field Engineer:

Wednesday, May 8, 2013

VMM 2012 SP1 VM Template - Region Settings revert back to en-US

I thought I would share a common problem that is experienced when configuring Regional Settings on a VM template.

Here is the scenario:
You build your VM with your required OS and make the required customisations for your environment. In most cases (unless you are in the US) this would require changing the Regional Settings. Once you are happy you run the sysprep oobe - generalize and shutdown the VM ready to be moved to the library.

You generate the VMM template from the VM in your library. You run your first test a realise that all the Regional setting have been changed back to English US.

During the above process the regional settings is reverted back to 'en-US'. This functionality is acknowledged in this MS KB article: http://support.microsoft.com/kb/2709539

To configure the proper regional settings for your template you can run a number of PowerShell cmdlets that will update the unattend settings (specifically oobeSystem/Microsoft-Windows-International-Core/UserLocale).

For Australia I generally need to configure the User Locale to 'en-AU' (English-Australia) and the keyboard to 'en-AU' also.

To do this I run the following PowerShell cmdlets (no need to change SystemLocale or UILanguage for Australia region settings):

$template = Get-SCVMtemplate | where {$_.Name -eq "Template - Windows Server 2008 R2 SP1 Enterprise"}
$settings = $template.UnattendSettings;
$settings.add("oobeSystem/Microsoft-Windows-International-Core/UserLocale","en-AU");
$settings.add("oobeSystem/Microsoft-Windows-International-Core/SystemLocale","en-US");
$settings.add("oobeSystem/Microsoft-Windows-International-Core/UILanguage","en-US");
$settings.add("oobeSystem/Microsoft-Windows-International-Core/InputLocale","0c09:00000409");
Set-SCVMTemplate -VMTemplate $template -UnattendSettings $settings



The above PowerShell commands can be modified for your region.

VMM VM Template - AutoLogonCount and AutoLogonCredential for RunOnce

Recently I created a VM template in VMM 2012 SP1 for a customer. A number customization scripts were created and added to RunOnce. The customer wanted the VM template to automatically logon with the local Admin account so all the RunOnce scripts would run automatically.

This is a pretty standard request and when configuring any unattend Windows install this is generally achieved by modifying the unnattend.xml file. However in VMM the Set-SCVMTemplate PowerShell cmdlet can be leveraged to configure this setting.

The 'Get-SCVMTemplate' cmdlet will show the current AutoLogon configuration. The AutoLogonCount and AutoLogonCredentialproperties must both be configured to achieve the Auto Logon functionality:

Get-SCVMTemplate -Name "VM Template Name"

When using AutoLogon in your VM Template it is also important to have a VMM 'Run As' account configured that has the local Admin credentials stored. Once the local Admin 'Run As' account is created, add it to the VM Template OS Properties for the local admin account.

The following PowerShell cmdlets can be used to configure AutoLogonCount and AutoLogonCredential properties:

#Get Template by name
($template = Get-SCVMtemplate | where {$_.Name -eq "VM Template Name"}) | fl Name, OperatingSystem, VirtualizationPlatform


#Get local admin account
($raa = Get-SCRunAsAccount -Name "VM Local Admin Run As") | fl Name, Username, Domain


#Set auto logon
(Set-SCVMTemplate -VMTemplate $template -AutoLogonCredential $raa -AutoLogonCount 1) | fl Name, AutoLogonCredential, AutoLogonCount



By using Run As account for the local admin account for the OS Properties and the AutoLogonCredential this allows the local admin account to be changed without needing to rerun the above PowerShell scripts.

Happy Templating!

Wednesday, May 1, 2013

ODX Trap! DPM 2012 & Hyper-V 2012 a CSV volume goes offline when you try to create a backup

I recently assisted a customer that was experiencing outages of their Hyper-V VM's that corresponded with a DPM 2012 CSV snapshot. After further investigation the following Failover Cluster event logs were found (around the same time of the VM outages):

Log Name: System
Source: Microsoft-Windows-FailoverClustering
Date: Date and time
Event ID: 5120
Task Category: Cluster Shared Volume
Level: Error
Keywords:
User: SYSTEM
Computer: Computer name
Description: Cluster Shared Volume 'Volume1' ('name’) is no longer available on this node because of 'STATUS_IO_TIMEOUT(c00000b5)'. All I/O will temporarily be queued until a path to the volume is reestablished.

Log Name: System
Source: Microsoft-Windows-FailoverClustering
Date: Date and time
Event ID: 5142
Task Category: Cluster Shared Volume
Level: Error
Keywords:
User: SYSTEM
Computer: Computer name
Description: Cluster Shared Volume 'Volume3' ('Cluster Disk 4') is no longer accessible from this cluster node because of error 'ERROR_TIMEOUT(1460)'. Please troubleshoot this node's connectivity to the storage device and network connectivity.

It was evident that DPM 2012 snapshots were causing the IO errors. I came across this hotfix: http://support.microsoft.com/kb/2813630

The hotfix was applied across all the Hyper-V hosts.

A great feature of Windows 2012 is that it is Offloaded Data Transfer (ODX) capable straight out of the box! However when your Storage Array is not ODX capable this is where the CSV I/O errors will start occurring on snapshot operations.

As a result I had to run the following PowerShell command to turn off ODX on all the Hyper-V hosts (see: http://technet.microsoft.com/en-us/library/jj200627):

Check to see if ODX is Enabled/Disabled
Get-ItemProperty hklm:\system\currentcontrolset\control\filesystem -Name "FilterSupportedFeaturesMode"

Disable ODX
Set-ItemProperty hklm:\system\currentcontrolset\control\filesystem -Name "FilterSupportedFeaturesMode" -Value 1

This is my first Private Cloud and Hyper-V blog (it is also my very first blog). I'm a Consultant for a Brisbane Integrator and I specialise in System Center and Hyper-V technologies. I have decided to share my journey and findings with everything that entails Private Cloud, System Center and Hyper-V.

I hope to start off slowly with a few blogs here and there over the next few months and let's see what happens from there!