VmWare: Defrag all your virtual machine disks through command line

Some people are happy to wait for the progress bar in a setup screen to tick to 100%.

Power users would rather create a script that'll do it for them, without locking up VMware (still leaves the disk locked, but you can still run other guest machines).

To run a defrag from CLI:

"%PROGRAMFILES%\VMware\VMware Workstation\vmware-vdiskmanager" -d "X:\Virtual Machines\Windows 7 x64\Windows 7 x64.vmdk"

To defrag ALL of them in one line:

cd path\to\your\vms

for /R .\ %i in (*.vmdk) do "%PROGRAMFILES%\VMware\VMware Workstation\vmware-vdiskmanager" -d "%i"

This scans recursively for any vmdk files and runs the vmware-vdiskmanager command on it.


Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog