In an earlier post Directory partition has not been backed up [DC=virtualcenter,DC=vmware,DC=int] I suggested a method to backup the VMwareVCMSDS ADAM database. As Joern posted in a comment, this solution could fill up your D: drive. The following code should help cleanup the ESXiBackup folder and only keep one month worth of history. You can append this to the previous script or schedule it as a separate task.
$vcenter = “vcenter.host.name” #This variable may already be defined if you append the previous script.
foreach ($i in Get-ChildItem D:\ESXiBackup\$vcenter)
if ($i.CreationTime -lt ($(Get-Date).AddMonths(-1)))
Remove-Item $i.FullName -recurse -force -confirm:$false -whatif
You’ll want to remove the “-whatif” once you see that the above script is what you want to do 🙂