Export-VMSnapshot error

Hello Geeks,

I have a script which is failing when running the command;

Export-VMSnapshot -ComputerName $VM.HostName -VMName $VM.Name -Name “PostSysprep” -Path C:\Temp -ErrorAction Stop


Export-VMSnapshot : Failed to export virtual machine ‘VMTemplate2016’ because export directory named

‘C:\Temp\Testexport\VMTemplate2016\Virtual Machines’ already exists. (Virtual machine ID xxxx31E8-xxxx-4156-9465-xxxx2635Exxx)

Please help, I have tried using different folder, different VM, same error.



I’d not use C:\Temp, to begin with. It’s complaining because it needs to create a bunch of subfolders, and the ones it needs to create already exist. It can’t overwrite them. Try specifying the name of an empty folder.

Thanks for reply Don!

I have tried different options in this direction, creating new folder in ‘Temp’ and outside temp but I get same error, I don’t understand when command is itself creating the folder why is it saying already exists?

Are there any child snapshots ?

Thank you Prasoon!

Your hint solved my problem, while investigating I created lot of snapshots. After clearing them this command executed properly.