Strange Creation Date on Hyper-V 2012 R2 VM

I have some VM´s on my new Windows 2012 R2 host that have a strange creation date on the properties.

The VM´s have been created on different times and it was a customer that noticed it.

quite fun as there was not computers or even Hyper-V invented in the 17 century or was it? 😉

Here is my lab/demo VMM 2012 R2 virtual machine and as you can see it is created the 1 of january 1601



and here is the other virtual machine, a windows 8 template

Screen Shot 2013-10-29 at 21.59.33


I have not been able to reproduce it now with either PowerShell or via the GUI, If you have seen the same issue please comment the post :-)

Updated download script for evaluation VHD for SysCtr 2012 R2

Now when the evaluation VHD´s have been updated with the release of the System Center R2 that was released last week I have updated my download script so you easily can get all the files at a convenient place with PowerShell and the BITS engine.

Good luck in your evaluation of the System Center 2012 R2 suite :-)


My experience on the newly released VMM 2012 R2 RTM

So as everyone else (at least an ITPRO with some dignity and self respect) I have started to download the System Center 2012 R2 as it was released just some hours ago! The link appeared on my technet subscription page about 1 PM in Swedish time

Screen Shot 2013-10-17 at 13.06.16

I started to Install the VM for my VMM and of course I created it as an Generation 2 VM on my Hyper-V R2 host.. In the preview, VMM could not manage gen2 VM´s but now we will see about that. Before installing VMM I had to download and install Windows 8.1 ADK and an SQL server.

Screen Shot 2013-10-17 at 14.26.04

And then when I had an successful installation I wanted to add at least one Hyper-V server, the funny part here is that I have activated Hyper-V on this Windows 2012 R2 and why it is saying unknown hypervisor beats me :-) . Fortunately I could proceed to add the host

Screen Shot 2013-10-17 at 14.44.26

And then I wanted to check the Gen2 VMM server I had created and see if it was viewable in the VMM console and also the system volume could be expanded when the VM was powered on (in earlier versions of VMM that has sometimes been a nono for example with VM additions )

Screen Shot 2013-10-17 at 14.51.09

Screen Shot 2013-10-17 at 15.04.35

As you can see there is no possibility in the VMM console to shrink the disk so there I have to use the Hyper-V Manager.. ( I have tried to enter a lower value but the gui won’t allow me to do it) So much for one place for all management.. In the following screendump you can see the option to shrink the storage from the Hyper-V manager wizard.

Screen Shot 2013-10-17 at 15.06.42

 And as you remember one of the new fine features in the Hyper-V R2 was the full feature RDP access to the VM through the VMbus, why has that not been implemented in the VMM??

Screen Shot 2013-10-17 at 15.14.40

 This old vmm viewer reminds me of the VMM 2008 with no additional features that I get in the Hyper-V Virtual machine connection..

Screen Shot 2013-10-17 at 15.15.56

I will continue to explore the VMM 2012 R2 and there might be some more blog posts coming and until then, good luck in your deployments :-)

Converting VHD´s to VHDX in SCVMM 2012 SP1 with PowerShell

I have in an earlier post described my little PowerShell function to migrate VM´s from a Windows 2008 R2 cluster to a new Windows 2012 Hyper-V cluster in VMM.

As it is a best practice to convert your VHD´s to VHDX I wanted to do that with SCVMM 2012 Sp1 also. It is a small detail that you need to be aware of when doing it in the VMM console, it does not remove the old VHD file from the datastore and in the GUI it is no checkbox for that either. This is the case for both VMM 2012 SP1 and R2 Preview. And if you start converting several VM´s VHD´s there is a possibility that your datastore will become full quite fast and that is not so good!

Screen Shot 2013-10-04 at 14.39.44

And on the folder where the virtual harddisk resides you can see that the vhd still exists..

Screen Shot 2013-10-04 at 14.57.15

In the PowerShell cmdlet Convert-VirtualDiskDrive there is a parameter -deletesource that removes the VHD once the conversion has completed :-)

So I have made a PowerShell function if you want to convert all your VHD´s on the virtual machine.

Good luck in getting the Hyper-V 2012 environment in the best shape ever before moving to 2012 R2!

PowerShell to the rescue when counting seminar attendees in Outlook

My company is going to host a seminar this thursday on Microsoft Sweden in the subject of Switch To Hyper-V.

Today I got the registrations from the guy receiving them from the company webpage. Every registration that is done results in a mail (yes I know! it is so old fashioned!!) Here is an example mail msg:

Screen Shot 2013-09-30 at 21.08.55

So to collect the info about the attendees and the information I used PowerShell.

on ScriptingGuys page I found their massage of Outlook and I added Attachment and Body objects to it.

Screen Shot 2013-09-30 at 20.55.52

And then as every mail was sent from the admin-guy as an attachment I had to save them to a local directory and from there do the extraction. It would have been easy to do the save for all just in Outlook if not all of  the emails had the same name!!

Screen Shot 2013-09-30 at 17.03.44

To fix that I used PowerShell again

Screen Shot 2013-09-30 at 20.48.52

And here is my script to get the attendees objects out

if you do have the mails in the inbox and not as an attachements you could use $switch.Body instead of saving them and using Get-Item :-)

New PowerShell VM Inventory Script for SCVMM 2012 SP1/R2

about 1 1/2 years ago I made a script for Inventory Reporting in SCVMM 2012 and now I have been working on an update that supports VMM 2012 Sp1 and R2, there have been some changes in the cmdlets so now it was time to refresh it and add some information.

In VMM 2012 R2 the possibility to get the IP address has been added so I utilize that from VMM, if you are using the SP1 version I can get the IP address from the Hyper-V PowerShell module and the cmdlet Get-VMNetworkadapter, that works only on Hyper-V 2012 Hosts and the Integration components have to be updated. The function reports the number of NIC´s and VHD´s but not show all, I have chosen to just add one virtual NIC and three virtual hard disks in this, that can be altered if you want and just add in the hash table.

In this new function I have added a switch parameter that lets you select if you want a html/csv report or just work with the objects that comes out of it when running :-)

To use it you can just use one of several ways with parameters

Screen Shot 2013-09-29 at 22.38.05


And here is the script function

And here is an example of the csv report, and yes it is much info, the CSV can be scrolled quite a bit :-)

Screen Shot 2013-09-29 at 22.27.45

You can select what you want included in the report by just using the function and pipe it to Export-CSV



Migration script for VM´s moving to Hyper-v 2012 from 2008r2 with VMM

As you might have been reading on my blog about the implementation of the SCVMM 2012 SP1 I have been doing at a customer and the challenges with networking and hosts.

Now the turn has come to migrate those VM´s that reside on the old 2008 R2 cluster to the new shiny Hyper-V 2012 cluster. The approach this time has been to use the VMM and migrate them between the clusters.

VMM 2012 SP1 has some shortcomings when it comes to different configured clusters and their networks. With a bit of crafty PowerShelling I solved that.

So the error was that I could not set the network that I wanted in the migration on the target.. In the VMM Console I get a error and could not continue :

Screen Shot 2013-09-26 at 09.47.36

Then I thought that its maybe an issue in the GUI and can be override in the PowerShell console but NOOOO there exist no parameter for setting the virtual switch :-(

Screen Shot 2013-09-26 at 09.44.49

So I wrote a little script function that first get the VLAN information on the network adapters connected on the VM and then disconnects the virtual network adapters for the VM before migration and then the migration succeeds  :-) and after the migration I connect the virtual network adapters to the VM networks on the new logic switch that correlates to the right VLAN from the source.

from a previous bad experience when trying to migrate VM´s between versions of Hyper-V on VMM with snapshots (Checkpoints) I added a check in the function to not allow migration of VM´s that have active snapshots.

Screen Shot 2013-09-26 at 14.28.54

And here is the script (will do some more thorough testing and add some functionallity but it gives you the idea )


When to select SC Orchestrator over vCenter Orchestrator


I got a question from a customer why they should choose System Center Orchestrator instead of vCenter Orchestrator.

Both products work in the automation field and can do quite much, as they both are extendable and you can develop add-ons, the possibilities are almost endless!

In the case of the System Center Orchestrator, it is included in the System Center suite so if you already use some of the components  and have the licenses in place then you can start automating a lot more.

In the case of vCenter Orchestrator, it is included in the vCenter license that you buy in your vSphere suite.

Both orchestrators are very easy to start working with as they are gui based. the vCenter Orchestrator integrates into the vSphere client and from there you can easily start the wanted workflow. With both you can create workflows/runbooks and let users connect to a web console to kick of the action.

Example of a runbook from SCO


Example of a workflow from vCO

Screen Shot 2013-09-26 at 09.53.23

In both there are possibilities to automate for example Active Directory and users. Onboarding processes when new employees start is an example of an process that often involves quite some manual intervention and benefits from automation. Giving end users and system owners the possibility to create and manage their own virtual machines through a web portal is another example that would offload the IT departments technicians busy day. The list of examples goes on and on…

System Center Orchestrator Architectural overview:

Screen Shot 2013-09-25 at 21.49.06

vCenter Orchestrator Architectural overview:

Screen Shot 2013-09-25 at 21.39.22

Comparison table:

Licensing License required only for endpoints being managed.
No additional System Center licenses are needed for management servers or SQL Server technology.
vCenter standard license, no extra cost
Web console Yes Yes
Third Party Plugin/IP Yes Yes
Custom Plugin/IP development Yes Yes
Manage VMware vSphere Yes Yes
Manage System Center Yes No (not out of the box,requires quite a bit of customization)
Workflow/Runbook templates No Yes
Import/Export Workflow/Runbooks Yes Yes


 So what orchestrator should you go with? Well it depends of course and here is my opinions,

If you have a VMware environment but run mostly Windows Servers and Microsoft applications and already have one or more System Center roles deployed the favor is in the SCO hand as SCO integrates so well with the Microsoft software using the supported Integration Packs and you also can with the VMware IP manage the vSphere environment. The rich amount of activities that the Integration Packs consists of makes it easy to start automating and quickly expand the scope and get some serious automation results in the whole stack! The SCO community helps you a lot when creating runbooks and that with the possibility to import a whole set of runbooks from other IT Pro´s can get your automation goal to be achieved quickly.

If you have a VMware environment and do not use any System Center roles and also have a more diverse load of VM´s with different operating systems, but still want to start automating your environment I would recommend the vCO. One big advantage that the vCO has is that it comes with a wide range of workflows already created and ready to be customized which helps you in the speed to automate.

From a licensing perspective it should be noted that as described in the table, you must have a System Center license on every physical device you plan to automate with System Center Orchestrator. On the virtualization hosts you would use the Windows Datacenter and System Center Datacenter licenses that gives you unlimited VM´s that you can manage. On single physical hosts you must use a System Center Standard license, but as I said above, if you already have another System Center Role you probably have the licensing in place :-). vCenter Orchestrator comes with the vCenter license and there is no extra licensing cost for managing single hosts or Active Directory.

Adding old 2008 R2 Hyper-V Cluster to SCVMM 2012 SP1

At a customer I have been deploying a new System Center Virtual Machine Manager 2012 Sp1.

I was here and deployed their previous solution with VMM 2012 and BareMetal deploy of their hosts. They have been patching and updating the hosts with the integration of wsus in VMM. As I described in an earlier post my first intention was to upgrade the database but after some investigation and trials I decided to start fresh instead…

So with the new installation I wanted to add the old Hyper-V cluster and manage it from the VMM 2012 SP1 and also be able to do migration from the old bare metal deployed hosts and cluster to the new cluster.

After adding the 2008 r2 cluster I had two nodes that did not respond correctly and with the following error

Screen Shot 2013-09-24 at 11.18.17

I tried to restart the VMM-agent on the hosts and that did not help, also tried to reboot the servers, which did not help either.

On one node I also tried to uninstall the VMM agent on the host itself and then to get it back into VMM involved some VMM-database massage, and that did not help either.

So what did help?!

Rebuilding the performance counters as this KB2554336 describes

To rebuild all Performance counters including extensible and third-party counters, type the following commands at an Administrative command prompt. Press ENTER after each command.

Rebuilding the counters:
     cd c:\windows\system32
     lodctr /R
     cd c:\windows\sysWOW64
     lodctr /R

Resyncing the counters with Windows Management Instrumentation (WMI):

Stop and restart the Performance Logs and Alerts service. 
Stop and restart the Windows Management Instrumentation service.

and then restart the VMM agent did solve the above issue and now the hosts reports nicely in VMM

Screen Shot 2013-09-24 at 11.02.45

The hosts had been reporting correctly in the old VMM 2012 so what caused the per counters to go bad, maybe the installation of the new VMM 2012 SP1 agent? If you have had the same issues, please comment this post and share your thoughts!

Updated Add-SCNetworks function for virtual Networks in SCVMM 2012 SP1

Yesterday I described how I could get the networking info out from the VMM before a reinstall or if for another reason you need to get all networks defined.

In an earlier post I described my add networks script and now I have extended it a bit. I have this week made a function of it and also I have changed the import file format to fit the export-file as you get with the earlier post mentioned above. In the function I create a logic network if it is not already in place, that is also done for the network site in the logic network. The logic network created utilize VLAN.

So If you create or export a file with the following columns, Name, Subnet,VlanID you are going to success.

Screen Shot 2013-09-21 at 18.00.22

And when running the function:

Screen Shot 2013-09-21 at 18.05.13

One thing that I wanted also was the possibilty to create just one network with the script and that has also been added.

Screen Shot 2013-09-21 at 18.07.10

The function also handles if you already had setup a network with the same subnet and gives you a warning and do not create that net (maybe you accidentally try to add the same net twice and that is being handled)

Screen Shot 2013-09-21 at 18.11.55

Here is the function

# Add Networks to VMM 
# Niklas Åkerlund 2013-09-16
   Add networks to the logical network and creates virtual networks to them
   this function can take either a csv file as input for creating virtual networks
   Add-SCNetworks -importfile .\networks.csv
   Add-SCNetworks -Name DMZ -Subnet -VlanID 100 -VMHostGroup DMZHosts
Niklas Akerlund 2013-09-16
function Add-SCNetworks
        # Logical Network Name
        $LogicalNetworkName = "LumaNets",

        # Network site name
        # CSV file to be imported
        $ImportFile = " ",

        # Name of the VM network
        $VMHostGroup= "All Hosts"


        $LogicalNet = Get-SCLogicalNetwork -Name $LogicalNetworkName
        # If the logical network not exist, create it
            $logicalNet = New-SCLogicalNetwork -Name $LogicalNetworkName -LogicalNetworkDefinitionIsolation $true -EnableNetworkVirtualization $false -UseGRE $false -IsPVLAN $false
        Write-Verbose $LogicalNet.Name
        $LogicalNet = $LogicalNetwork

    $allSubnetVlan = @()

    # The networks that is going to be imported
    if ($ImportFile -ne " "){
        $vlans = import-csv $ImportFile -Delimiter ";"

        foreach ($vlan in $vlans) {
            # Check that the actual network not already is configured
            if(!((Get-SCLogicalNetworkDefinition).SubnetVLans.Subnet -contains $vlan.Subnet)){

                # First in fabric 
                $LogicalNetDef = Get-SCLogicalNetworkDefinition -LogicalNetwork $LogicalNet -Name $LogicalNetDefName
                $allSubnetVlan = $LogicalNetDef.SubnetVLans    
                $Subnet = $vlan.Subnet 
                Write-Verbose $Subnet
                $SubnetVlan = New-SCSubnetVLan -Subnet $Subnet -VLanID $vlan.VlanID
                $allSubnetVlan += $SubnetVLAN
                    Set-SCLogicalNetworkDefinition -LogicalNetworkDefinition $LogicalNetDef -SubnetVLan $allSubnetVlan
                }else {
                    $LogicalNetDef= New-SCLogicalNetworkDefinition -LogicalNetwork $LogicalNet -Name $LogicalNetDefName -SubnetVLan $allSubnetVlan -VMHostGroup $VMHostGroup

                # Then create VM Networks
                $vmNetwork = New-SCVMNetwork -Name $vlan.Name -LogicalNetwork $LogicalNet -IsolationType "VLANNetwork"
                #$vmSubnet = 
                New-SCVMSubnet -Name $vlan.Name -LogicalNetworkDefinition $LogicalNetDef -SubnetVLan $SubnetVLAN -VMNetwork $vmNetwork
                Write-Host "Subnet $Subnet already exists" -ForegroundColor Red
        # add only a single network
            if(!((Get-SCLogicalNetworkDefinition).SubnetVLans.Subnet -contains $Subnet)){
                # First in fabric 
                $LogicalNetDef = Get-SCLogicalNetworkDefinition -LogicalNetwork $LogicalNet -Name $LogicalNetDefName
                $allSubnetVlan = $LogicalNetDef.SubnetVLans    
                #$Subnet = $IPnet + $Octet
                Write-Verbose $Subnet
                $SubnetVlan = New-SCSubnetVLan -Subnet $Subnet -VLanID $vlanId
                $allSubnetVlan += $SubnetVLAN
                    Set-SCLogicalNetworkDefinition -LogicalNetworkDefinition $LogicalNetDef -SubnetVLan $allSubnetVlan
                }else {
                    New-SCLogicalNetworkDefinition -LogicalNetwork $LogicalNet -Name $LogicalNetDefName -SubnetVLan $allSubnetVlan -VMHostGroup $VMHostGroup

                # Then create VM Networks
                $vmNetwork = New-SCVMNetwork -Name $Name -LogicalNetwork $LogicalNet -IsolationType "VLANNetwork"
                #$vmSubnet = 
                New-SCVMSubnet -Name $Name -LogicalNetworkDefinition $LogicalNetDef -SubnetVLan $SubnetVLAN -VMNetwork $vmNetwork
                Write-Host "Subnet $Subnet already exists" -ForegroundColor Red

It works on both VMM 2012 SP1 and VMM 2012 R2 (preview)

I have looked at Alvin Morales latest blog post about creating networks and will see if I can add some more functionality into my code later on, I think that using parameters instead is a better way. There is always improvements that can be done and the only problem is the time 😉