Szukam sposobu, aby utworzyć punkt przywracania systemu z bieżącą datą i godziną, naciskając przycisk. Próbowałem przeszukać sieć w prosty sposób to zrobić, ale jeszcze nie znalazłem.Jak programowo utworzyć punkt przywracania systemu?
Znalazłem ten fragment kodu z: http://msdn.microsoft.com/en-us/library/windows/desktop/aa378847%28v=vs.85%29.aspx, ale to jest w VB, a nie C#, próbowałem trochę go przekonwertować, ale nie sądzę, że wykonuję świetną robotę tłumaczenia tego.
'CreateRestorePoint Method of the SystemRestore Class
'Creates a restore point. Specifies the beginning and
'the ending of a set of changes so that System Restore
'can create a restore point.This method is the
'scriptable equivalent of the SRSetRestorePoint function.
Set Args = wscript.Arguments
If Args.Count() > 0 Then
RpName = Args.item(0)
Else
RpName = "Vbscript"
End If
Set obj = GetObject("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")
If (obj.CreateRestorePoint(RpName, 0, 100)) = 0 Then
wscript.Echo "Success"
Else
wscript.Echo "Failed"
End If
Zobacz także to pytanie: http://stackoverflow.com/questions/32845/creating-system-restore-points-thoughts – M4N