Export-VMSnapshot error

Welcome Forums General PowerShell Q&A Export-VMSnapshot error

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
3 months, 2 weeks ago.

  • Author
    Posts
  • #109742

    Participant
    Points: 57
    Rank: Member

    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

    Error;

    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.

    Thanks,

    Kishor

  • #109766

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    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.

    • #109846

      Participant
      Points: 57
      Rank: Member

      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?

  • #109996

    Participant
    Points: 878
    Helping Hand
    Rank: Major Contributor

    Are there any child snapshots ?

    • #110023

      Participant
      Points: 57
      Rank: Member

      Thank you Prasoon!

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

The topic ‘Export-VMSnapshot error’ is closed to new replies.