0
1
From a how-to-geek article, I get a script like this:
strDesc = "Restore Point by script"
Set oArgs = WScript.Arguments
If oArgs.Count > 0 Then strDesc = oArgs(0)
WScript.Echo "Creating Restore Point: " & strDesc
Set oRestorePoint = GetObject("winmgmts:\\.\root\default:SystemRestore")
strResult = oRestorePoint.CreateRestorePoint(strDesc, 0, 100)
If strResult <> 0 Then
WScript.Echo "Error " & strResult & ": Unable to create Restore Point"
WScript.Sleep 444000 'Let user see the result
Else
WScript.Echo "Restore Point created successfully."
WScript.Sleep 2000 'Let user see the result
End If
WScript.Quit strResult
I create a scheduled task with this script on Windows 7 to have it create restore point for me daily, and it works well.
However on Windows 8.1/10, I find a strange behavior. Inside a Administrator CMD, executing
cscript CreateRestorePoint.vbs
does not create a new restore point when any restore point has existed(but it still prints "Restore Point created successfully"). In other word, cscript CreateRestorePoint.vbs
creates a restore point only after I do vssadmin delete shadows /all
, but a second run of cscript CreateRestorePoint.vbs
fails due to the existing of first restore point. -- This problem does not happen on Windows 7 SP1.
Can someone explain and fix this problem on Windows 8.1/10 ?
[[[ UPDATE: Problem Solved ]]]
Just as Ken points out in his comment, adding a registry key [HKLM\Software\Microsoft\Windows NT\CurrentVersion\SystemRestore] SystemRestorePointCreationFrequency=10
is the solution(reboot required) . Since Windows 8, Microsoft defaultly allows create only one restore point every 24 hours. SystemRestorePointCreationFrequency=10
decrease that limit to 10 miniutes. See this MSDN page.
Try "winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore" (taken from this article).
– harrymc – 2015-11-06T08:52:49.133