Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
http://msdn.microsoft.com/library/en-us/sr/sr/system_restore_wmi_classes.asp?frame=true
http://support.microsoft.com/default.aspx?scid=kb;en-us;295299
The following sample script enumerates the current restore points.
Requirements
Windows NT/2000/XP: Included in Windows XP. Windows 95/98/Me: Unsupported.
objWMI = GetObject("winmgmts:root/default") objSR = objWMI.InstancesOf("SystemRestore") foreach objRP in objSR str = StrCat("Dir: RP ",objRP.SequenceNumber,@LF,"Name: ",objRP.Description,@lf,"Type: ",objRP.RestorePointType,@lf,"Time: ",objRP.CreationTime) Message("SystemRestore data",str) next objSR = 0 objWMI = 0 exitThe following sample script rolls back to a Specific Restore Point NOTE: Do not use this function without also calling a computer shutdown. System Restore may not work properly if a restart of the computer is not initiated immediately.
sequencenum = 22 ;parameter passed to Restore method is the sequence number of the restore point you want to roll back to. objWMI = GetObject("winmgmts:root/default") objSR = objWMI.InstancesOf("SystemRestore") objSR.Restore(sequencenum) objSR = 0 objWMI = 0 ;reboot system. Intcontrol(67,0,0,0,0) exit
objWMI = ObjectGet("winmgmts:root/default:SystemRestore") SRP = objWMI.createRestorePoint("put description here", 1, 100) objWMI = 0Refer to the msdn article referenced here for the correct parameters to pass. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sr/sr/createrestorepoint_systemrestore.asp
List Restore Points
;Winbatch 2009B - enumerate Restore Points ; ;WMI query output as .csv ; ;Stan Littlefield July 20, 2009 ;/////////////////////////////////////////////////////////////////////////////////// ComputerName = "." oWMIService = GetObject("winmgmts:\\":ComputerName:"\root\default") oItems = oWMIService.ExecQuery("Select * from SystemRestore") cFile=DirScript():"restorePoints.txt" If FileExist(cFile) Then FileDelete(cFile) cOut="Name,Sequence,Type,Time":@CRLF If oItems.Count == 0 Then Display(2,"System Restore Points","No restore point in system.") Else oDate = CreateObject("WbemScripting.SWbemDateTime") cItems="" ForEach oItem In oItems cName= oItem.Description cSequence = oItem.SequenceNumber Select oItem.RestorePointType Case 0 cType = "Application installation" Break Case 1 cType = "Application uninstall" Break Case 6 cType = "Restore" Break Case 7 cType = "Checkpoint" Break Case 10 cType = "Device drive installation" Break Case 11 cType = "First run" Break Case 12 cType = "Modify settings" Break Case 13 cType = "Cancelled operation" Break Case 14 cType = "Backup recovery" Break Case oItem.RestorePointType cType = "Unknown" Break EndSelect oDate.Value = oItem.CreationTime cTime = oDate.GetVarDate cOut=cOut:cName:",":cSequence:",":cType:",":cTime:@CRLF Next FilePut(cFile,cOut) Display(2,"Restore Points Captured",cFile) EndIf oItem=0 oItems=0 oWMIService=0 oDate=0 Exit ;///////////////////////////////////////////////////////////////////////////////////
Article ID: W16756
File Created: 2009:07:20:09:33:36
Last Updated: 2009:07:20:09:33:36