PDT

Image

Live migration fails of Private Cloud VMs after using PDT


no-live-migrationIf you try to live migrate the Private Cloud VMs after using the PDT VMCreator.ps1 you’ll get an error similar to this:

The reason is that the OS disk in each of the 15 VMs is a differencing disk. To convert all 15 disks from Differencing to Dynamic, I developed the following Powershell script:

# Script to convert Differencing Disk to Dynamic on all VMs on current host
# Sam Boutros
# 6/2/2014
# Convert-DiffDisk.ps1
# Needed after using PDT to create private cloud VMs – cannot live-migrate VMs with differencing disks
#
$Loc = Get-Location
$Archive = $Loc.Path + “\Delete.me”
new-item $Archive -type directory -ErrorAction SilentlyContinue
$Date = Get-Date -format yyyyMMdd_hhmmsstt
$logfile = $Loc.path + “\Convert_” + $Date + “.txt”
#
function log($string, $color)
{
if ($Color -eq $null) {$color = “white”}
write-host $string -foregroundcolor $color # Sorry Don Jones 🙂
$temp = “: ” + $string
$string = Get-Date -format “yyyy.MM.dd hh:mm:ss tt”
$string += $temp
$string | out-file -Filepath $logfile -append
}
#
function Convert_Disk0($VM)
{
$Disk0 = Get-VMHardDiskDrive -VMName $VM -ControllerType IDE
$Source = $Disk0.Path
$Destination = $Source.Insert($Source.IndexOf(“.vhdx”,1),”_C1″)
log “Stopping $VM VM” green
Stop-VM -Name $VM
log “Converting disk $Source” green
Convert-VHD -DestinationPath $Destination -Path $Source -VHDType Dynamic
log “Attaching new disk $Destination to $VM” green
Get-VMHardDiskDrive -VMName $VM -ControllerType IDE | Set-VMHardDiskDrive -Path $Destination
log “Starting $VM VM” green
Start-VM -Name $VM
log “Moving old disk file $Source to $Archive folder” green
Move-Item $Source $Archive
}
#
$VMs = Get-VM -ComputerName $env:COMPUTERNAME
# To convert the IDE disk on all VMs on the current host use the following line:
# Foreach ($VM in $VMs.Name) { Convert_Disk0 $VM }
# To convert the IDE disk of a single VM use the following line – replace “VMM01” as needed:
Convert_Disk0 “VMM01”

Advertisements

PDT error ADK81\adksetup.exe incorrect version


Background:

PDT is the Powershell Deployment Toolkit for System Center developed by Rob Willis of Microsoft.


Issue:

When you run the PDT VMCreator.ps1 script you get error:

..Failed ADK81 incorrect version

ADK81


Solution:

Edit line 2828 of workflow.xml changing it from:

<FileVersion>8.100.26020</FileVersion>

to:

<FileVersion>8.100.26629</FileVersion>

This is the current version (as of 5/24/2014) of adksetup.exe which is located under Installer\Prerequisites\ADK81 folder:

ADK81b


Alternative work- around:

You can run VMCreator.ps1 with the -SkipValidation switch