{"id":162,"date":"2010-09-21T08:44:44","date_gmt":"2010-09-21T12:44:44","guid":{"rendered":"http:\/\/enterpriseadmins.org\/blog\/?p=162"},"modified":"2013-02-10T14:08:23","modified_gmt":"2013-02-10T19:08:23","slug":"esxibackup-folder-cleanup","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/scripting\/esxibackup-folder-cleanup\/","title":{"rendered":"ESXiBackup Folder Cleanup"},"content":{"rendered":"<p>In an earlier post <a href=\"http:\/\/enterpriseadmins.org\/blog\/?p=152\">Directory partition has not been backed up [DC=virtualcenter,DC=vmware,DC=int]<\/a> 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.<\/p>\n<pre><code class=\"language-powershell\">\r\n$vcenter = \"vcenter.host.name\" #This variable may already be defined if you append the previous script.\r\n#http:\/\/technet.microsoft.com\/en-us\/library\/ee176988.aspx\r\nforeach ($i in Get-ChildItem D:\\ESXiBackup\\$vcenter)\r\n{\r\n    if ($i.CreationTime -lt ($(Get-Date).AddMonths(-1)))\r\n    {\r\n        Remove-Item $i.FullName -recurse -force -confirm:$false -whatif\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>You&#8217;ll want to remove the &#8220;-whatif&#8221; once you see that the above script is what you want to do \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/scripting\/esxibackup-folder-cleanup\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-162","post","type-post","status-publish","format-standard","hentry","category-scripting","category-virtualization"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/comments?post=162"}],"version-history":[{"count":4,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/162\/revisions"}],"predecessor-version":[{"id":1195,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/162\/revisions\/1195"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}