My Theater Community Session on Ignite – be there or …

Today I was browsing the session catalog on myIgnite and could see that my session “PowerShell Community Jewels” was now added to the list!

Screen Shot 2015-04-22 at 09.21.40

So if you will be going to Chicago and also attending the Microsoft Ignite conference I would love to see you on the Lounge B Theater on Tuesday!

Me self and The Swedish Chef will be there and maybe just maybe there will be a possibility for you to take a selfie with the Chef after the session!


(Last year at Teched Houston with Mr PowerShell himself)


Playing with the Azure VM agent and changing user on IaaS VM with PowerShell

I am at a Azure training at Microsoft and have been playing a bit with both the portal and PowerShell.

We where talking about the VM agent that is installed on the IaaS VM´s and what functionality it has.

There is a nice and powerful feature that allows you to reset the password for the user from the Azure PowerShell console. The cool part is that you also can change the user on the VM so if you have to take over a Azure IaaS deployment and do not know the username or password for the virtual machines you can change it!

from Keith Mayers blog post I used the PowerShell code and changed both password and username for a user

So first of all in my Windows 2012 R2 I have a user vniklas and I want to change it to Bruno, but as I said above you do not have to know the username that is set inside the VM´s to be able to change it!

Screen Shot 2015-04-20 at 16.33.09

And I use PowerShell to set a credential with username and password:

Screen Shot 2015-04-21 at 10.14.56

And the following change both user and password, updates the VM and then to actually get it to hit on the VM I need to restart the VM:

Screen Shot 2015-04-21 at 10.24.11

And when you then try to use RDP in to the VM you need to use the new password and username and as you can see on the Local Users the account have changed to bruno instead.

Screen Shot 2015-04-20 at 16.21.53

Here is the PowerSHell code to get this to work:

And now as you see that this is so easy you can realize that your Azure subscription account becomes quite important to keep safe and not let anyone get access to it.

May the force be with you!

Exclude VM´s from dynamic optimization in SC VMM

In a case where we had a VM that was a bit sensitive with an application that does not like the ping loss during live migration between hosts in a cluster we wanted to exclude the vm from the automatic dynamic optimization. It might not be totally clear where you find this setting for the VM´s you want to exclude from this load balancing act.

First of all, do you know where you set up automatic dynamic optimization in System Center VMM 2012 R2? For some reason you set it up on the hosts folder and not on the cluster object in VMM:

Screen Shot 2015-04-16 at 13.00.13


So where do you exclude VM´s from this optimization? If you look under a VM´s properties you can check the actions and there you see the magic checkbox :

Screen Shot 2015-04-16 at 12.55.35

And now when the automatic job runs my sensitive VM will stay on the host.

SC VMM Error 803 after restoring a duplicate VM with alternative name

I was at a customer today testing some backup/restore scenarios with their backup providers software and where we got an interesting error: 803 “Virtual Machine restore-Test5_gen1 already exists on the virtual host other cluster nodes” Recommended Action: “Specify a new name for the virtual machine and then try the operation again”



In the Backup/restore console we wanted to do a restore to alternative place and an alternative name as we had not deleted the original VM (for instance if you need files or just verify some state or something), in the configuration of the restore job we checked that the restore process would create a new VM Id which was the first thing we thought that was why VMM complained.

The thing was that this error only appeared when we did a restore to another hyper-v host, if we restored to the same where the original VM was residing there was no error..

As you can see after the restore both the original VM and the alternate had the same “#CLUSTER-INVARIANT#” id but different VMId´s, and when we tried to refresh VM´s we got the error above.

Screen Shot 2015-03-30 at 20.56.59

The solution was not so farfetched and can be read about in the KB2974441 although that case is about RDS VDI but still, and as can be read about why the ID is in the notes field from the beginning: “VMM adds a #CLUSTER-INVARIANT#:{<guid> } entry to the description of the VM in Hyper-V. This GUID is the VM ID SCVMM uses to track the VM.”

For the VM not showing up in VMM console we just went into the notes field on Hyper-V Manager and removed that specific “#CLUSTER-INVARIANT#” id and after that VMM generated a new for that VM and it appeared in the VM list on the VMM server.

So why was it no problem when we restored to that same host? For some reason VMM managed to see the duplicate residing on the same host and generate a new id in the notes field for that and thus appearing in the VM list without any massage..


Hyper-V Powershell module now with 211 cmdlets in build 10041

I have upgraded my windows 10 to the latest build 10041 and activated Hyper-V.

Screen Shot 2015-03-20 at 09.45.22

In this build I can see that there are now 211 cmdlets in the hyper-v PowerShell module:

Screen Shot 2015-03-22 at 10.58.57

And comparing it to the PowerShell module that was released in Windows 8.1/2012 R2 you can see the following new cmdlets, although the Windows 10 is in preview and things can change before it is released!

Screen Shot 2015-03-22 at 11.32.16

I will dig into the new preview release and maybe there will be a followup post on my findings!

Review of the new 5nine Manager 6.1

I have used both Hyper-V Manager and System Center VMM from the early beginning of Hyper-V in 2008. If you wanted to use a tool with several Hyper-V hosts either that was standalone or in cluster you had to use VMM, especially if using the deploy functionality with templates and OS customization.When System Center 2012 was released they decided to sell it as a whole product with different roles which means you have to buy either a System Center Standard (for single managed server hosting up to 2 VM´s) or a System Center Datacenter (Virtualization hosts using 2pCPU with unlimited managed VM´s on that licensed host). There are though some alternative and one of them is the 5nine Manager.


5nine Manager has been evolving for some version since they first saw daylight and now they have added some really cool features making it a real competitor to VMM and if you do not use the other System Center roles this could be a good buy.

part of the new 6.1 version, these new features exist:

  • Graphical Monitoring Plugin and Alerts 
  • New Optimizer Notifications 
  • Increased Scalability through Multiple Console Instances 
  • Simplified VM Management with Sortable Table Parameters 
  • Enhanced VM Templates 
  • Integrated Sysprep Tool 

The gui can be run on a Hyper-V Core server so no excuse here now to not use that for your virtualization hosts! I actually have had some discussions with customers why they do not want to run core because if the host would be disconnected and they would need to do some debug and analysing they thought that it would be to difficult when using core instead of the full gui. With the 5nine Manager you can manage and check your VM´s in a GUI but within the Core session :-)

To get it working in your environment you need to install it on a Windows box. The nice thing here is that you can run it on a Windows 8.1/8/7 and connect to the different Hyper-V versions.

Screen Shot 2015-03-01 at 19.42.00

Once installed you need to add Hyper-V hosts/clusters to manage them.

Screen Shot 2015-03-01 at 19.44.39

The GUI in the console is quite easy to use and as you can see, I can right click on a VM and convert it as a template to be able to provision new VM´s. Another really nice feature which you can see in the list is “Set IP address” and this uses the functionality of the integrational services and sets the IP on the vNic inside the VM!!

Screen Shot 2015-03-01 at 20.36.15

 And as you can see there are some more options in the bar with optimizer,monitor, reporting best practices and Hyper-V logs. I really like the GUI and that it is easy to find the different options and tasks not having to jump around between different views forever. Having a single pane of glass when searching Hyper-V hosts for failing VM´s or hardware issues through logs then this Manager is great.


As described above, If you do not use more than System Center VMM in your virtualization environment and the list price for System Center R2 Datacenter is about 3600 $ and the 5nine Manager would cost from 199 $ per host then there is not so much to argue about! There is also a free version of the 5nine Manager that you can use combined with VMM on your Windows Hyper-V Core hosts.

Unitrends Enterprise backup v8.0 for Hyper-V

I have been looking at some different backup software solutions and now the turn has come to check out Unitrends Enterprise Backup.

They have a new version 8.0 that supports not only VMware but also Hyper-V virtualization platforms and also several different OS such as Mac OS and HP-UX, which can run in physical or virtual machines. There are either virtual or physical appliances of the backup solution so it is quite easy to get the backup solution up and running as you can start with the virtual appliance and get into a protected state within just an hour or so. And if you start with a virtual appliance you can later add a physical at another site and use it as a replication target.

Some nice features are:

  • Unitrends Bridge for Hyper-V, with:
    • Windows Instant Recovery from any physical or virtual guest to a Hyper-V VM.
    • Hyper-V Instant Recovery – running a hypervisor level backup instantly from the backup storage.
  • NDMP support for enterprises.
  • Support for Mac OS 10.9 and HP-UX 11.
  • Guest level protection for Shared VHDXs.
    • Note this is an important feature of 2012 R2 for HA that Unitrends can support and other Host OS backup solutions cannot because you cannot do hypervisor level backups of this config.
  • Improved SQL performance and deduplication.
  • Unified Baremetal.


I wanted to test and see how easily I could get it up and running on my Hyper-V environment and how can I could use it for moving VM´s/workloads from physical or VMware?

First of all you download either an iso or an vhd packed as an EXE from the web page and then you deploy it to an hyper-v host:

Screen Shot 2015-01-26 at 10.59.35

Then when it has been deployed, it has to be configured with IP and other settings and once that is completed you can test and see that you have succeeded with the right settings:

Screen Shot 2015-01-26 at 11.20.27

One important thing is when deployed as a virtual appliance, add vhdx´s to store the backups on, as usual it is quite smart to think twice where you put these and not in the same storage as the protected VM´s as the idea is to survive if you have a failure :-). Initially when the appliance is deployed it has a system disk on a vhdx that is dynamic and can expand to 200 GB.

Screen Shot 2015-01-26 at 12.23.47

The Console GUI then is accessible through a flash-enabled browser and it is really easy get started. As you can see on the following screen dump you can add several appliances and use them either as a local backup system or a vault:

Screen Shot 2015-01-26 at 12.16.05

After initiating and installing the agent on the Hyper-V host I could see it in the console and also see all VM´s running on the host:

Screen Shot 2015-01-26 at 12.51.07

First off I tested to backup and restore a simple VM, which of course worked flawlessly:

Screen Shot 2015-01-26 at 12.54.19

And then I wanted to test to backup and restore a generation 2 CentOS VM:

Screen Shot 2015-01-26 at 13.36.53

Last off I wanted to test the functionality of instant recovery and doing a v2v from vmware to hyper-v. I installed an UEB agent in the OS on the VM in the VMware VM and configured instant recovery in the UEB console to a Hyper-V host.

Screen Shot 2015-01-26 at 19.39.45


The Unitrends Enterprise Backup is really easy to get started with and you are instantly up and running with your backups of the virtual and also physical environment from one virtual backup appliance. With the different features you can use it for both backup and also for instant recovery. Only thing I would like to see is that the flash GUI would be exchanged to a full HTML5 GUI instead, and of course a PowerShell module would make it complete 😉

Hyper-V VM´s BIN files, to be or not to be in clusters

If you create lots of VM´s with large amount of RAM memory assigned to them and start to wonder why you have used some of the storage on the volumes then this is because if you have set up a VM without changing anything you get a bin file in the VM folder that corresponds to the size of the allocated RAM. This file is used to save the VM`s RAM to disk when the VM is going into saved state!

Screen Shot 2015-02-19 at 12.23.41

In an environment where you have all VM´s as clustered resources you will not need to be able to use the saved state when shutdown the host as you will live migrate the VM´s when doing stuff with the HW.

The setting is easily found in Hyper-V Manager for an already deployed VM:

Screen Shot 2015-02-19 at 12.22.06

It is not so easily found in System Center VMM when checking the VM properties, but when deploying a new VM you find it in the wizard:

Screen Shot 2015-02-19 at 12.29.26

If you want to change the setting for your VM´s running in a cluster via VMM you will have to use PowerShell and it is quite easy to do that with a one-liner, first you see the setting with the PowerShell command Get-SCVirtualMachine and then you can configure it with Set-SCVirtualMachine :

Screen Shot 2015-02-19 at 12.40.18
Screen Shot 2015-02-19 at 13.29.46

And now when checking the folder for the VM the BIN file has magically shrunk to 4KB :-)

Screen Shot 2015-02-19 at 13.44.03

Error dialog when opening VMM console after update to VMM 2012 R2 UR5

I have updated a VMM server with the latest UR5 and now when opening the console the following error appears

Screen Shot 2015-02-18 at 11.17.31

This was quite easily handled as you can see the folder is there but looking a bit further I found that authenticated users of the had no NTFS rights on the particular folder.

Screen Shot 2015-02-18 at 11.21.33

After updating and adding authenticaded users as described in the release notes of the UR5 and giving it access to HostSIdeAdapters I did not get any error messages after starting the console

VM Storage Migration in VMM 2012 R2 leaves unwanted leftovers

I have been playing around with a case where we have been upgrading and creating a new Windows Server 2012 R2 Hyper-V cluster and adding CSV volumes to it, and when first volume became full we started to storage migrate the VM´s to another volume but for some reason the files where left behind so I created my own PowerShell function to handle that as the built-in does not have that parameter and for some reason leaves leftovers?!

As you can see when I have done a live storage migration within a Hyper-V host with the GUI in VMM it leaves both vhdx and xml of the VM, and that can be troublesome when someone tries to import that VM while the other is already running and also you do not gain that space you thought would be reclaimed because you did a live storage migration.

Screen Shot 2015-02-16 at 15.38.54

No problem to move but as you can see in the volume that I migrated from:

Screen Shot 2015-02-16 at 15.06.32

And the volume that I migrated to:

Screen Shot 2015-02-16 at 15.06.55

I have been reproducing the migration with either just folders or both folders and vhdx/xml files still at the source..

When I run my function it cleans the source if i use the parameter -deletesource

Screen Shot 2015-02-17 at 15.51.08

Here is the PowerShell function for you to try:

Good luck in your automation :-)