batch to defrag & shrink vmdk's

rem first power down the vm
call "C:\Program Files\VMware\VMware Server\vmware-cmd" "D:\Virtual Machines\_in production\VM folder\vm name.vmx" stop

rem defrag from vmware cmd line util
"C:\Program Files\VMware\VMware Server\vmware-vdiskmanager.exe" -d "D:\Virtual Machines\_in production\VM folder\Windows XP Professional.vmdk"

rem mount vmdk
"%programfiles%\vmware\vmware server\vmware-mount" v: "D:\Virtual Machines\_in production\VM folder\vm drive.vmdk"

rem prep vmdk
"%programfiles%\vmware\vmware server\vmware-vdiskmanager" -p V:

rem unmount vmdk
"%programfiles%\vmware\vmware server\vmware-mount" v: /d -f

rem shrink vmdk
"%programfiles%\vmware\vmware server\vmware-vdiskmanager" -k "D:\Virtual Machines\_in production\VM folder\vm drive.vmdk"

rem some day....
rem ntbackup the vm to a fs
ntbackup backup @c:\backups\VM folder.bks /j "VM folder" /f "\\gbsnjprifs3\NTbackup1\VS3\VM folder.bak" /l:s /m normal /v:no /snap:on

rem last power on the vm
call "C:\Program Files\VMware\VMware Server\vmware-cmd" "D:\Virtual Machines\_in production\VM folder\vm name.vmx" start

Popular posts from this blog

first bugger

Make Firefox Look Like Internet Explorer

Windows XP Activation and P2V