Comments

1 comment

  • Avatar
    wojciechka

    There is no built-in action for performing it, but you can use VBScript to create a restore point.

    The example below creates a random point with project's <fullName> as name of the restore point:

    <writeFile>
        <path>${system_temp_directory}/createrestore.vbs</path>
        <text>Set SRP = GetObject("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")
        Result = SRP.createrestorepoint ("${project.fullName}", 0, 100)
    
        If Result = 0 Then
            Wscript.Exit 0
        Else
            Wscript.Exit 1
        End If
        </text>
    </writeFile>
    <runProgram>
        <program>cscript</program>
        <programArguments>/NOLOGO "createrestore.vbs"</programArguments>
        <workingDirectory>${system_temp_directory}</workingDirectory>
    </runProgram>
    <deleteFile>
        <path>${system_temp_directory}/createrestore.vbs</path>
    </deleteFile>
    

    More information on using SystemRestore, its attributes and methods can be found on MSDN.

Please sign in to leave a comment.