Tag Archives: PowerShell

Veeam extract and vmware-vdiskmanager

Since we’re too.. conservative.. to rely entirely on disk storage for our backups, we dump all our VMs to tape once every week. We don’t want to rely on Veeam Backup and Replication in order to restore from tape, so we decided to extract everything from the latest backup every saturday afternoon when no other backups are running.

We’re using Veeam Backup and Replications included extract utility for this, which will extract all vmx, vmdks etc to a folder of our choosing. After that, we want to 7zip the files before sending them off to a BackupExec job (nope, not relying on BackupExecs compression either). I ran into a problem when I was trying to write a simple batch file for the post processing, that would call vmware-vdiskmanager.exe to shrink all the vms extracted. vdiskmanager can’t handle wildcards, and needed the filenames passed to it, from subdirs (which included vm numbers) extracted by Veeam extract.

My solution is a quick and dirty powershell script which will call vmware-vdiskmanager on every vmdk it finds in the path specified (excluding the files we can’t shrink):

get-childitem -include *.vmdk -exclude *-flat.vmdk,*-ctk.vmdk -recurse | % {
echo "", "Processing $_"
D:\Veeam\bin\vmware-vdiskmanager.exe -k $_.FullName
}