Function to Delete Windows System Restore points.

PowerShell wrapper around Win32 API call to SRRemoveRestorePoint (Srclient.dll). The Delete-ComputerRestorePoint  function deletes the System Restore Points that are passed as argument or via pipeline as a result of a call to Get-ComputerRestorePoint. It is implemented as an advanced function supporting -WhatIf functionality.

 

 

PowerShell
Edit|Remove
#example usage: 
#"simulate" the deletion of all available System Restore Points 
Get-ComputerRestorePoint | Delete-ComputerRestorePoint -WhatIf 
 
#delete all System Restore Points older than 14 days 
$removeDate = (Get-Date).AddDays(-14) 
Get-ComputerRestorePoint |  
        Where { $_.ConvertToDateTime($_.CreationTime) -lt  $removeDate } |  
        Delete-ComputerRestorePoint