Installing SC Orchestrator 2012 SP1

Today I have been exploring the SC Orchestrator and its functionality with Hyper-V 2012 and SC VMM 2o12 SP1. First of all to get it installed I had to run the installations in “run-as” otherwise it failed during the wizard. I installed it on a Windows 2012, and one prerequisite is that you have the .net 3.5 installed also.

One annoying thing is when you add Integration Packs, unlike for example Operations Manager and importing management packs, you can only add one IP at a time when importing.. And if you want to add like 10-20 first time it is a bit tedious! Please fix that in the RTM.

Another thing that I encountered was an error I did not first understand. When I had added the SCVMM 2012 SP1 IP and wanted to use it, I first added some configuration data but apparently it was not enough cause when I tried to use it I got an error

So what was the error, I had not entered the VMM Console information in the following configuration dialog and apparently the IP uses Powershell under the hood and connects to the powershell console with the vmm module.

When that was configured correctly I could continue to create my first runbook, look at this link to get some SCORCH examples (really handy to get the idea of how to use it and that in runbook examples to have in your Orchestrator designer)

Here is an easy example, I enter a VM name and if the state is “Running” I stop it, and if the state is Stopped I start the VM:

I have been using Powershell quite a bit and not looking so much at the Orchestrator but it is really easy to get up and creating your runbooks. Try it out and see for yourselves.

SCVMM 2012 Evacuate VMHost and maintenance script

A customer found the bug that exists in the System Center Virtual Machine Managers function for setting a host in maintenance mode. The bug is that when you set a host in maintenance mode it will live migrate all VM´s to the next node in the cluster. This is kind of impractical when you for example want to patch the Hosts and you end up with the last host that is filled with in worst case all  VM´s on it and it takes longer time to live migrate them. The VMM bug should be fixed in the SC SP1 that is coming soon This of course depending on if you have enabled the Dynamic Optimization, that function helps you with the distribution but that will take some time before it runs.

He made a script for evacuating the host and distributing the VMs to the other nodes in the cluster. I have added a bit of logic that also set the host group to not allow dynamic optimization during the scripted evacuation.

The load balancing in my script is quite easy because right now the only thing I look at is the host memory and migrate the VM to the Host that has most memory left at the moment.

<#
.Synopsis
   A function to evacuate a host in vmm and set it in maintence mode
.DESCRIPTION
   This function migrates all your VM´s to other nodes in the cluster based on available Host memory
.EXAMPLE
   Evacuate-SCVMHost -VMHost hyp02 -HostGroup DC01
.Notes
Niklas Akerlund/Lumagate 2012-11-25
#>
function Evacuate-SCVMHost
{
    [CmdletBinding()]
    [OutputType([int])]
    Param
    (
        # What VMHost you want to set to maintmode
        [Parameter(Mandatory=$true,
                   ValueFromPipelineByPropertyName=$true,
                   Position=0)]
        $VMHost,

        # In what hostgroup the host resides 
        $HostGroup
    )
    # Get The cluster and disable the dynamic optimization during evac 
    $HostGroup = Get-SCVMHostGroup $HostGroup
    $HostGroup | Get-SCDynamicOptimizationConfiguration | Set-SCDynamicOptimizationConfiguration -ManualMode 
    $VMHost = Get-VMHost $VMHost
    # Evacuate the host
    $VMs = $VMHost | Get-VM
    foreach ($VM in $VMs){
        # Find the most apropriate Host in cluster for each VM
       $VMHostTarget = Get-SCVMHostCluster -VMHostGroup $HostGroup | Get-SCVMHost | where {$_.ComputerName -ne $VMHost.ComputerName} | Sort-Object AvailableMemory -Descending | Select-Object -First 1
       Move-SCVirtualMachine -VM $VM -VMHost $VMHostTarget  
        
    }
    # Set the host in maintmode
    Disable-VMHost -VMHost $VMHost -MoveWithinCluster
    # Enable dynamic optimization
    $HostGroup | Get-SCDynamicOptimizationConfiguration | Set-SCDynamicOptimizationConfiguration -AutomaticMode
   

At last now I am officially an MCSE:Private Cloud

At the MMS 2012 I had the opportunity to write the beta exam 71-246, Monitoring and Operating a Private Cloud with System Center 2012. This exam was released during the summer as 70-246

As my earlier post announced I could see on the Prometric site that I passed, but the MCP site did not reflect this and I waited quite a while but nothing happend, so I sent in a support request and now after a week I got a mail that they have solved the transfer from Prometric.

Here is a screendump of my certification transcript 🙂 and watch the date of achievement..

 

Good luck you other guys in achieving MCSE Private Cloud!

I passed the 71-246 at MMS 2012 -> MCSE: Private Cloud

As the buzz around twitter said that their result was showing I checked yesterday but on the Prometric site it just said “Tested”. When I woke up today I had to check again and now it looked better 🙂

As you can see I took the test at 4:30 PM on the first day of MMS 2012 so this means I am one of the first passing 🙂 , until someone else claims an earlier time I will say that I am the first MCSE : Private Cloud in Sweden 🙂

This as the requirement is MCSA and that I can count my 70-659 towards this certification 🙂

Good luck in testing!

Bare metal deploy with SCVMM 2012 fail with error 800b0109 in WinPE

Today I was at a customer and upgraded their VMM 2012 from RC to RTM. We got an issue when trying to run a bare metal deploy after the upgrade, at first we did not understand what was causing the error, but my suspicion was on the winpe that was published by VMM in the WDS PXE.

Here is the error in the VMM Console also

And then i used PowerShell to update the VMM WinPE that resides in the WDS, this because their environment had new HP blades and i needed to add a nic driver. If you do not need to add anything to the winpe you can right click on the VMM console and the PXE  and you find a selection “Update WinPE Image” this will use an image from the WAIK installed on the VMM Server. Here is the link for the powershell cmdlet that updates the WinPE

The Powershell I ran was as below, I had to run the dism tools with elevated rights, this can be done by right click on the Powershell console and “Run As Administrator”

Import-Module "C:\Program Files\Microsoft System Center 2012\Virtual Machine Manager\bin\psModules\virtualmachinemanager\virtualmachinemanager.psd1"
Get-SCVMMServer localhost
$mountdir = "E:\mount"

$winpeimage = "E:\temp\custom_winpe.wim"

$winpeimagetemp = $winpeimage + ".tmp"

mkdir "E:\mount"

copy $winpeimage $winpeimagetemp

dism /mount-wim /wimfile:$winpeimagetemp /index:1 /mountdir:$mountdir

$path = "E:\temp\drivers\be2nd62.inf" # $driver.sharepath
dism /image:$mountdir /add-driver /driver:$path

Dism /Unmount-Wim /MountDir:$mountdir /Commit

publish-scwindowspe -path $winpeimagetemp

Here is a link to the technet forum where I found another guy having the same issue, whom I helped.

After updating the WinPE we tried to do a new bare metal deploy and this time we had no issues with the certificate.

 

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 🙂

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)

Automatic installation of SCVMM 2012 RC & SQL 2008 R2 and WAIK 3

Today I have been researching how to make a script that deploys a working installation of a VMM 2012 RC with a local SQL server without needing to manually type in anything.

What is strange is that the WAIK itself does not give you an option to do a quiet install! I had to use msiexec Transform to massage it to allow for an unattended install.

I used this MyITforum page to get a SQL config file, and this post by Christoffer got me the waik installation bit.

One thing i changed in the SQL config was this line:

SQLCOLLATION=”SQL_Latin1_General_CP1_CI_AS”

because when i install on a OS with Swedish it will try to install with another Collation, this is no worries until you want to use this database server for SCOM 2012, because it requires the above Collation! 🙂

I am using the Start-Sleep cmdlet to get some time between the installations, also I have a check that the Setup process is still running and delay until it has finished,

You will have to download the WAIK 3.0 and the SCVMM 2012 RC, also you will have to copy all files from the SQL 2008 R2 ISO into a folder, as my script refers. Copy the content to subfolders like my screen dump and you should get it working. The .Net feature is installed during the SQL installation so i do not need to add it on its own.

# Install VMM unattended
#
# NIklas Akerlund /RTS

# Install the SQL server
c:\install\sql2008r2\setup /ConfigurationFile=c:\install\ConfigurationFile.ini

# Install the WAIK
msiexec /qb /i C:\install\KB3AIK_EN\wAIKAMD64.msi TRANSFORMS=c:\install\waikamd64.mst

Start-Sleep -s 60
# Install the VMM server and console

C:\install\vmm12\setup.exe /server /i
Start-Sleep -s 30
while (Get-Process | where {$_.ProcessName -eq "SetupVM"}){
Write-Host "Still installing server"
Start-Sleep -s 2
}
Start-Sleep -s 10
C:\install\vmm12\setup.exe /client /i
Start-Sleep -s 30
$Process = Get-Process | where {$_.ProcessName -eq "SetupVM"}
while (Get-Process | where {$_.ProcessName -eq "SetupVM"}){
Write-Host "Still installing Console"
Start-Sleep -s 2
}

When i run it, it looks like this

There are some configuration files that could be used to set up other parameters for ports/license keys etc and they reside in the VMM setup directory and their names are VMServer.ini and VMClient.ini, for my demo/test setup i decided to not change anything. If you want to know more parameters in the VMM setup, just run in powershell console or CMD, setup /? and you will get a dialog with options

System Center Online Seminars: Deep Dive VMM 2012

Today Me self and Joachim Nasslander did our last Live Meeting about the System Center VMM 2012 in swedish for Microsoft. We did not have time to show all our demos so i thought that it would be an idea that i show them here in a blog post. There is no sound on the demo-videos, hopefully the LM that was recorded will show up on the Swedish MS technet soon…

The first thing that i showed was the Bare Metal Deployment of hosts, this is done with the help of a prepared VHD and a WDS (Windows deployment Server) that is registered to the VMM server. I have cut a bit of the waiting when the server was finalizing the configuration.



The next demo was after deployment of the host I used the built in functions in VMM 2012 to add hosts to a cluster




After this I show how to use the integration between the WSUS and the VMM which gives the opportunity to update a cluster and set the cluster nodes into maintenance mode and then update rolling through all hosts and the VM´s live migrating to the hosts.



I also made a demo on how to v2v migrate a VM from vSphere host to a hyper-v host when they are all connected to the same VMM 2012




Lastly I have made a demo on how to use Powershell within the VMM 2012 and how to use it to both do reporting and changing things, I have already made some blog posts about how to use the VMM 2012 powershell cmdlets.



Using SCVMM 2012 SP1 CTP to administer my Win 8 Hyper-V hosts

This night I saw that MS, listened to my tweet 😉  where I asked for possibility to manage Hyper-V 3 with the SC VMM2012. I have children that let me wake early and so I could start immediately to investigate the new SP1 and see how it works to handle Win8/HyperV3 hosts.

In my test environment I have two hosts  hyp31 and hyp32, I have also a virtual machine for the VMM (vmm3) and a virtual file server all of them running the Win8 Server Beta.

The installation was pretty straight forward, The only problem was that I had to have a internet connection to be able to get the .Net 3.5 feature installed.

When the VMM server and console was Installed I could login and add some hosts

As I already had set up the host and had VM´s on the fileshare it was easy to start testing Live Migration between the hosts (they are not in a cluster but both can access the fileshare).

Get-SCVirtualMachine MAJS | Move-SCVirtualMachine -VMHost HYP31 -Path "c:\VMs"

I have to use the -Path parameter but only a xml config file resides on the host and my vhd harddisk remains on the fileshare \\win8fs\vmds , will do some research building a cluster and see how that works with the files later..