JSI Tip 8976. How can I retrieve all the available Restore Points on a Windows XP Professional computer?

I have scripted enumRP.bat to retrieve all the available Restore Points on a Windows XP Professional computer.

The syntax for using enumRP.bat varies based upon your desires:

To list the Restore Points:

enumRP

Would display information similar to:

813 2005 01 19 22 27 36 474168 - 000 "System Checkpoint"
814 2005 01 20 21 37 13 396004 - 000 "Installed Windows XP KB884020."
815 2005 01 20 22 41 54 599488 - 000 "Installed DropMyRights"
816 2005 01 21 23 15 24 024273 - 000 "System Checkpoint"
817 2005 01 22 12 58 20 563630 - 000 "Installed Log Parser 2.2"
818 2005 01 23 14 45 39 802115 - 000 "CrtRP"
819 2005 01 23 14 51 40 299887 - 000 "Restore Operation"

To process all Restore Points:

setlocal
for /f "Tokens=*" %%a in ('enumRP') do (
 call :erp %%a
)
endlocal
goto :EOF
:erp
set RPSeq=%1
set RPYear=%2
set RPMonth=%3
set RPDay=%4
set RPHour=%5
set RPMinute=%6
set RPSecond=%7
set RPMicroSec=%8
shift
shift
shift
shift
shift
shift
shift
shift
set RPOffsetSign=%1
set RPOffsetMins=%2
set RPDesc=%3
@echo %RPSeq% %RPYear% %RPMonth% %RPDay% %RPHour% %RPMinute% %RPSecond% %RPMicroSec% %RPOffsetSign% %RPOffsetMins% %RPDesc%
Where:
RPSeq         is the Restore Point Sequence Number.
RPYear        is the four digit year that the Restore Point was created.
RPMonth       is the 2 digit month that the Restore Point was created.
RPDay         is the 2 digit day that the Restore Point was created.
RPHour        is the 2 digit hour, using a 24 hour clock, that the Restore Point was created.
RPMinute      is the 2 digit minute that the Restore Point was created.
RPSecond      is the 2 digit second that the Restore Point was created.
RPMicroSec    is the 6 digit microsecond that the Restore Point was created.
RPOffsetSign  is the sign, plus or minus, that signifies the offset from UTC (coordinated universal time).
RPOffsetMins  is the offset in minutes that the originating time zone deviates from UTC.
RPDesc        is the System Restore description.
NOTE: See the following tips:

How can I create a Restore Point in Windows XP, from the command-line, or from a batch?
How can I restore a Windows XP Professional Restore Point from the command-line, or from a batch?
How can I test the status of the last Windows XP Professional System Restore?
How can I use the command-line, or a batch, to disable Windows XP Professional System Restore on one or all drives?

enumRP.bat contains:

@echo off
setlocal
set eRPVBS="%TEMP%\eRP_%RANDOM%.VBS"
@echo set eRP = getobject("winmgmts:\\.\root\default").InstancesOf ("systemrestore")>%eRPVBS%
@echo for each Point in eRP>>%eRPVBS%
@echo wscript.Echo point.creationtime ^& " 
^& point.description ^&
" ^& point.sequencenumber>>%eRPVBS% @echo next>>%eRPVBS% set /a cnt=0 for /f "Tokens=*" %%r in ('cscript //nologo %eRPVBS%') do ( call :enum %%r ) del /q %eRPVBS% endlocal goto :EOF :enum set rpcrt=%1 set rpdesc=%2 set rpseq=%3 set rpyyyy=%rpcrt:~0,4% set rpmon=%rpcrt:~4,2% set rpday=%rpcrt:~6,2% set rphour=%rpcrt:~8,2% set rpmin=%rpcrt:~10,2% set rpsec=%rpcrt:~12,2% set rpms=%rpcrt:~15,6% set rputcos=%rpcrt:~21,1% set rputcomin=%rpcrt:~22,3% @echo %rpseq% %rpyyyy% %rpmon% %rpday% %rphour% %rpmin% %rpsec% %rpms% %rputcos% %rputcomin% %rpdesc%



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish