Ищу способ создать точку восстановления системы с текущей датой и временем по нажатию кнопки. Я пытался найти в Интернете простой способ сделать это, но пока не нашел.
Я нашел этот фрагмент кода на: http://msdn.microsoft.com/en-us/library/windows/desktop/aa378847%28v=vs.85%29.aspx, но это в VB, а не в C#, я попытался немного преобразовать его, но я не думаю, что у меня хорошо получается переводить его.
'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