header image

Restore points

Posted by: | June 2, 2010 | No Comment |

One really good idea I saw in the recent Scripting Games concerned modifying the registry.  How many times have you seen the warning – modifying the registry is dangerous, it can wreck your laptop, cause global warming and lead to the energy death of the universe.

One way to avoid these calamities is to create a restore point on your computer before making the changes. Another way is to use transactions but we’ll cover that another time.

Creating a restore point in PowerShell v2 is easy – just use the checkpoint-computer cmdlet

Checkpoint-Computer -Description "Test for blog" -RestorePointType MODIFY_SETTINGS

Other types are available:

  • APPLICATION_INSTALL
  • APPLICATION_UNINSTALL
  • DEVICE_DRIVER_INSTALL
  • MODIFY_SETTINGS
  • CANCELLED_OPERATION

In the event of a problem and you need to roll back Restore-Computer is used but first you have to find the restore points which we can do with

Get-ComputerRestorePoint

All we do then is

Restore-Computer -RestorePoint 227

or whatever sequence number you need from the output of Get-ComputerRestorePoint.

A simple way to protect your computer and still get the job done.

as a final word you do need to run PowerShell as an administrator to work with restore points.

under: PowerShellV2