How to restore operating system to an earlier time ?  Download
This page contains the example of how to restore the computer to one of the earlier check points. It is designed for Windows XP, Server 2003, and higher operating systems. This example is using TWmiConnection and TWmiMethod components from WmiSet component collection. The source code below creates and destroys the components on the fly, so it may be used in UI- and console-type applications. Remember to reboot the destination computer after the restoration process is complete.

// This function is for Windows XP or higher. It restores the operating 
// system to the specified restore point. 
// It may be used for local or remote host. When used for local host 
// Destination, UserName and Password parameters must be empty. 
// For remote computer, parameters must be: 
// TargetHost: name or IP address of the remote host, like '10.8.36.54' 
// UserName: name of the user, may include domain, like 'MOON\Administrator'; 
// Password: the user's password. 
// Number: the sequence number of the restore point to use. 
//          ListRestorePoints function returns available restore points. 
//          See "How to enumerate available system restore points?" topic. 
// The method returns empty string on success and error description otherwise 
function SystemRestore(Destination, UserName, Password: string; Number: integer): string;
var
  Connection: TWmiConnection;
  Method: TWmiMethod;
begin
  Result      := '';
  Connection  := TWmiConnection.Create(nil);
  Method      := TWmiMethod.Create(nil);
  try
    try
      Connection.MachineName := Destination;
      Connection.NameSpace   := 'root\default'; 
      Connection.Credentials.UserName := UserName;
      Connection.Credentials.Password := Password;
      Connection.ObjectPath := 'SystemRestore';
      Connection.Connected := true;

      Method.WmiObjectSource := Connection;

      Method.WmiMethodName := 'Restore';
      Method.InParams.ParamByName('SequenceNumber').AsInteger := Number;
      if Method.Execute <> 0 then
      begin
        Result := Method.LastWmiErrorDescription;
        if Result = '' then Result := 'Error ' + IntToStr(Method.LastWmiError);
      end;

    finally
      Method.Free;
      Connection.Free;
    end;
  except
    on E: Exception do Result := E.Message;
  end;
end;