Import virtual machines or template operation of Microsoft Test Manager throws ‘Object reference not set to an instance of an object’’

The content of this blog is applicable if you are using Team Foundation Server 2012 Update 4 with System Center Virtual Machine Manager 2012 R2.


Problem:  When you try to import a virtual machine or template to Team Foundation Server library using Microsoft Test Manager(MTM), import wizard throws ‘Object reference not set to an instance of an object’‘ . This issue occurs when you have any VM or template with no description in your Virtual Machine Manager(VMM) library share that you have configured to Team Foundation Server(TFS) and you are trying to import them to TFS.


Work Around:  To fix this error make sure you add description to all the VMs or templates in your Virtual Machine Manager library share and then perform import operation using MTM.

To get list of all the templates or VMs which does not have description, you can run the following PowerShell script in VMM PowerShell console.

$templates = Get-SCVMTemplate -All -VMMServer <VMMServerName>
$templates |  select {$_.description -eq $null }, Name