Error when using export-vm

Mar 13, 2012 at 5:43 PM

Hello,

I'm trying to export a VM using "Export-VM -VM mdc-dc03 -Path c:\temp -CopyState -Force".

When I start PowerShell with admin privilege, I get this error:

Test-WMIResult : Attempt to export MDC-DC03 to c:\temp failed. InvalidStateForOperationAt C:\temp\HyperV\VM.ps1:28 char:113+                 if ( ($VSMgtSvc.ExportVirtualSystem($VM.__path,($CopyState.Ispresent),$path)    | Test-wmiResult <  -wait:($wait -or $preserve) -JobWaitText ($lstr_ExportOfVm -f $vm.elementName)`    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Test-WMIResult

 

If I start Powershell with no privilege, nothing happens (no error but no action).

Any idea?

Mar 16, 2012 at 10:46 PM

First question:  Was the VM in a stopped state? 

Test-WMIResult : Attempt to export MDC-DC03 to c:\temp failed. InvalidStateForOperationAt C:\temp\HyperV\VM.ps1:28

Mar 19, 2012 at 1:59 PM

No. I tested with stopped VM and it works. 

So, is there any way to export/backup a running VM?

Mar 20, 2012 at 5:16 PM

No, export can only be performed on a stopped VM.  Back is a different issue.  You can use a variety of backup tools at the OS level or, if the backup tool supports VSS, at the host level.