18 Oct 2011 @ 6:05 PM 

My last post got me thinking… I myself have a rule-of-thumb that all snapshots will be removed in my environment if they are older than 6 weeks.
I used to do this manually with the SCVMM console… but I dislike manual labor Bedroefde emoticon

So, I did some playing around in my latest favorite tool: PrimalScript Glimlach
This is what I came up with:

Get-VMCheckpoint | ForEach-Object {if ($_.AddedTime -lt (Get-Date).AddDays(-42)) {Remove-VMCheckpoint -VMCheckpoint $_}}

As you can see, I am using the AddDays method. Why I did not use the AddWeeks method?
Simple answer: It doesn’t exsist (yet) Knipogende emoticon
http://technet.microsoft.com/en-us/library/ee176845.aspx

Post to Twitter

Posted By: Jeff Wouters
Last Edit: 23 Apr 2012 @ 06:25 AM

EmailPermalink
Tags
Categories: Hyper-V, PowerShell, Script, SCVMM


  • Atouba5

    Hi Jeff, is it also possible to “remove old snapshots” without the scvmm?

  • http://www.jeffwouters.nl Jeff Wouters

    Hi Atouba5,
    Sure that’s possible. When using Windows 8 you can use the native Hyper-V PowerShell cmdlets, but if you’re running an earlier version you can either download the Hyper-V PowerShell module from CodePlex, created by James O’Neill. And if neither of those is an option for you, using WMI and the native buildin PowerShell modules Windows 7 / Server 2008 R2 can do the trick. Read the following post by Ben Armstrong for more information on the later: http://blogs.msdn.com/b/virtual_pc_guy/archive/2011/10/20/deleting-a-snapshot-via-powershell-hyper-v.aspx


Get Adobe Flash player
 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 164
  • Comments » 150
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.

Contact



    No Child Pages.