How to Export and Import a VMware Virtual Machine using PowerCLI

  1. Run Windows PowerShell as Administrator
  2. Install PoweCLI: Install-Module -Name VMware.PowerCLI
    1. Alternatively, you can download PowerCLI from here: https://code.vmware.com/tool/vmware-powercli
  3. Create a folder where you want to export the virtual machine. I’ll use the OVA format in this example. Note the path to the folder.
  4. Run PowerCLI as Administrator
  5. Load the PowerCLI module: Import-Module VMware.PowerCLI
  6. Connect to vCenter: Connect-VIServer <vCenter name>
  7. Enter credentials
  8. Export the virtual machine: Get-VM “VM name” | Export-VApp -Destination “<folder name\file name>” -Format OVA
    1. Alternatively, you can export to OVF format
  9. Import the virtual machine: Import-VApp “<absolute path\file name>” -VMhost “<host name as it appears in vCenter>”
    1. Optional parameters
      1. -Datastore “<data store name>”
      2. -DiskStorageFormat Thin