Hyper-V 2012 Compare-VM PowerShell Cmdlet Error

I wanted to get this information out as when I was researching the error below I could not find any information on it online or in our internal database. Hopefully it helps someone out there and they don’t have to have a night sleep to have their, eureka moment.


When running Compare-VM command against a Hyper-V guest configuration file, do not rename the file. If the file name is not in GUID format, the following error will occur. After renaming the file to a GUID format, the command worked fine. Using any GUID seems to work, as I deleted the VM from Hyper-V Manager and didn’t have the original GUID available.


PS C:\> compare-vm -Path “C:\temp\test2008.xml” -verbose

VERBOSE: compare-vm will import the virtual machine saved at “C:\temp\test2008.xml”.

compare-vm : Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

At line:1 char:1

+ compare-vm -Path “C:\temp\test2008.xml” -verbose

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Compare-VM], FormatException

    + FullyQualifiedErrorId : Unspecified,Microsoft.HyperV.PowerShell.Commands.CompareVMCommand

Comments (2)

  1. Thanks for the comment dimanski. This is behavior is expected, so it would not be classified as a bug. It just was not expected by me at the time. Renaming key configuration files is not a good idea usually, so hopefully this will help if someone does rename the guest configuration file.