Tuesday, 4 July 2017

PowerCLI Script to Backup all VMX files to Local Disk (2017)

Requirements:
Windows Server/Windows Machine with Powershell.
PowerCLI from Vmware.

Open PowerCLI with administrator rights and type the below commands.

connect-VISERVER nameofhostorvcenter

cd vmstore:\datacenter\nameofdatastore

Copy-DatastoreItem -Item *\.vmx -Destination S:\nameoflocaldrive

To copy the files back

Copy-DatastoreItem -Item S:\nameoflocaldrive\*.vmx -Destination vmstore:\datacenter\nameofdatastore