Upgrade SCVMM 2012 RC to RTM

Today I wanted to upgrade my test environment from SC VMM 2012 RC to RTM, as it clearly says in the documentation, this is not supported (unless you are a TAP customer). But do not shout out in anger just until you read the forum, cause you can actually get the db upgrade util even if you weren’t in the TAP program.

Now I was one of the lucky to be in the TAP program so I could download the upgrade binary. First I had to uninstall the VMM Server and the Console, not to forget was to retain the database data (otherwise an upgrade would kind of be meaningless)

When the uninstall was complete, start an elevated prompt and run the tool, if you run UpgradeVMM2012RC.exe /?  you can see what different parameters you can use.

Now I could continue with the installation, but next little problem was to reconnect the old library (my library was not on the default path) so if would choose the existing I would not get my Library correct and I could not change that either in the installation wizard, I selected create a new and got the following error:

This was solved by going to the actual folder and deselect share, without restarting the installation i could continue

Then I was finished installing and the only thing left was to update the VMM agents on the hosts, some people had problems with the need to remove the agent manually but my update was successful

So now I am running the RTM version of SC VMM 2012 🙂

VMware vExpert 2012 award

 

I am one of the lucky to be awarded as this year VMware vExpert.

As described by the application for VMTN vExpert:

The annual VMware vExpert title is given to individuals who have significantly contributed to the community of VMware users over the past year. The title is awarded to individuals (not employers) for their commitment to sharing their knowledge and passion for VMware technology above and beyond their job requirements.

My focus has been on automation and I try to share my findings in PowerCLI, and of course in other areas too.

Is there a PowerCLI way then I will use it!

Windows Server 2012 (8 beta) Hyper-V enabled inside a VMware Fusion VM

I did see that a new version of VMware Fusion has been released as a technology preview and in the release notes I could find that it was possible to run ESXi host-vm with nested 64 bit VM´s in. Of course I had to test and see if I also could get a new Windows 2012 (8 beta) with Hyper-V role enabled and running.

There was some problems that had to be adressed before I got it working, google and help from fellow IT-neerds that had done the same in VMware Workstation solved my problems. And yes it is actually usefull, because I can run a test environment on my Apple laptop to test/demo things 🙂

After a clean install i got this error when trying to enable

I had to add these lines to the vmx file inside the VM package

hypervisor.cpuid.v0 = FALSE
vhv.enable = TRUE

I also manually set the preferred virtualization engine to Intel VT-x with EPT

Then i could add the Hyper-V role, but when rebooting i got a nice new kind of blue screen with the error HAL_MEMORY_ALLOCATION.

That was solved with the following line in the vmx file, I have no idea what it means exactly but it has to be something with the memory allocation,

mce.enable = TRUE

Here you can see my screendump on my Hajper-V VM with a Hyper-V VM running inside it 🙂

I have not installed VMware tools in the host, this because when enabling the Hyper-V role the OS that is installed becomes an Parent VM, so the tools will not be utilized on the Fusion VM´s hardware.  

 

A PowerShell function for Snapshot reporting in VMM2012

Hello

I am in the hotel waiting for the MMS 2012 to start so there is time for some automation ;-). Last week when I was teaching a course one of the attendes said after I showed the custom value function, that he also wanted a similar function for easy in the console check how many snapshots every VM had. In the VMM 2012 console I have not found an built-in function to actually show this.

I have modified the function and created the run script, this is scheduled to run once a hour so you have a updated view of your environment. At least in the Hyper-V for Windows 2008 R2 it is not recommended to use in production.

It is quite easy to create a new custom property that we then will populate,

New-SCCustomProperty -Name "Snapshot Count" -Description "" -AddMember @("VM")

In the GUI there is no way to remove a custom property, I can only remove it from assigned properties. During the course I created an property just for showing and want to get rid of it. Of course there is a powershell cmdlet for that:

Get-SCCustomProperty -Name "Muuuu" | Remove-SCCustomProperty

But now to the part of getting the script to show snapshots (yes I know, in VMM it is called Checkpoints but i refuse to call it that)

First I have the PowerShell function

function Set-CVSnapShot{
<#
.SYNOPSIS
Function to Update custom values for VM´s in VMM 2012
 
.DESCRIPTION
Use this function to  set the custom value Snapshot count
 
.PARAMETER  VMs
Use this parameter to update just that VM´s custom snapshot value
 
.NOTES
Author: Niklas Akerlund / RTS
Date: 2012-04-16
#>
    param (
   [Parameter(Position=0,HelpMessage="A virtual machine pleaze",
    ValueFromPipeline=$True)]
    $VMs = " "
    )
   
  	if ($VMs -eq " "){
    	$VMs = Get-SCVirtualMachine
	}else{
		$VMs = Get-SCVirtualMachine  $VMs
	}
	
  	$CustomSnapShot = Get-SCCustomProperty -Name "Snapshot Count"
   
	foreach ($VM in $VMs){
		$count = ($VM | Get-SCVMCheckpoint).Count
		
	    if($count -ne $null){
	        Set-SCCustomPropertyValue -InputObject $VM -CustomProperty $CustomSnapShot -Value $count 
	    }else{
	        Set-SCCustomPropertyValue -InputObject $VM -CustomProperty $CustomSnapShot -Value 0 
	    }
   }
}

then I have a very easy script that I task scheduled in my VMM server

# Script to use for scheduled updates of Custom values
#
# Niklas Akerlund / RTS 2012-04-16

ipmo 'C:\Program Files\Microsoft System Center 2012\Virtual Machine Manager\bin\psModules\VirtualMachineManager' | Out-Null

. .\Set-CVSnapshot.ps1
Set-CVSnapshot

And in the VMM Console it looks like this

I will talk to some VMM responsibles at MMS and see if they find an interest and build the view instead of me running it in a sheduled task (as the information is there in the database)

Importing VM´s with PowerShell into Win8 Hyper-V 3.0

I am working on setting up my lab environment for the M50273 Design course that I am going to teach next week.

The import process is a bit heavy without powershell, cause it is 18 VMs that has to be imported. In a MOC (Microsoft Official Course) the lab setup consists of several VM´s that have base vhd disks and then several tiers of differential disks that need to be connected before import, in every directory there is a .bat file that creates the symlinks, I decided to keep them but run them in a script.

And here you can see the result of running the .bat file

The setup guide for the course says that I should install a Windows 2008 R2 host and then import the VM´s but i want to use Win8 instead, this to be able to run the built-in hyper-v cmdlets and also test if I could run the course VM´s on it.

I did not have this problem (Matthew Dowst) when importing my VM´s to the host but another networking issue occured, when checking the VM settings as you can see in the screen dump that the virtual network adapter is there but not working correctly, a little powershell again helps 😛

And this powershell command that takes the network adapter on the vm and connects it to the Internal switch :

Get-VM *HOU-DPM-E* | Get-VMNetworkAdapter | Connect-VMNetworkAdapter -SwitchName Internal

So then it looks like this in VM settings:

So to automate the import process I created a small script that looks in a directory for VM´s in folders to import, then starts each .bat script to create the symlinks and imports the machine and lastly renames it (cause in the import process it is named REARMEDxxx) and connects the vm to the right network

As you can see, in this script i have not created a function or fancy parameters, that might come in a version 0.2.

# Import VMs for Course
#
# Niklas Akerlund / RTS 2012-04-04

$VMs = Get-Item -Path "E:\Program Files\Microsoft Learning\50273\Drives\*" | Select-Object Name,FullName

foreach ($VM in $VMs){
    
    if(Get-VM $VM.Name -ErrorAction SilentlyContinue ){
        Write-Host $VM.Name "Already imported"
    }else{
        # Create Symlinks
        $symbat = (Get-Item ($VM.FullName + "\*.bat")).FullName
        & $symbat

        $expfile = (Get-Item ($VM.FullName + "\Virtual Machines\*.exp")).FullName
        
        Import-VM -Path $expfile 

        Get-VM REA* | Rename-VM -NewName $VM.Name
        Get-VM $VM.Name | Get-VMNetworkAdapter | Connect-VMNetworkAdapter -SwitchName Internal
    }
}

It looks something like this when running

And when it is done I have all my 18 VMs imported and with the right network connected: