JSI Tip 9057. How can I use the registry to determine if the last Windows XP System Restore was successful?

I had previously scripted TstLstSR.bat to determine the status of the last System Restore.

I have scripted TstLstSRReg.bat to use the registry to determine the status of the last System Restore.

The syntax for using TstLstSRReg.bat is:

call TstLstSRReg RetVal

Where RetVal is a call directed environment variable that will contain:

Y   if the last System Restore was successful.
  if the last System Restore was interrupted.
N  if the last System Restore failed.
X  if a System Restore was never performed.

NOTE: See the following related tips:

How do I prevent my Windows XP domain members from disabling or altering their System Restore settings?
How can I create a Restore Point in Windows XP, from the command-line, or from a batch?
How can I retrieve all the available Restore Points on a Windows XP Professional computer?
How can I restore a Windows XP Professional Restore Point from the command-line, or from a batch?
How can I use the command-line, or a batch, to disable Windows XP Professional System Restore on one or all drives?

TstLstSRReg.bat contains:

@echo off
if \{%1\}==\{\} @echo Syntax: TstLstSRReg RetVal&goto :EOF
setlocal
set name=%1
set OK=X
set qry=reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\SystemRestore" /V RestoreStatus
call :quiet>nul 2>&1
endlocal&set %name%=%OK%
goto :EOF
:quiet
set wrk=0x3
for /f "Tokens=3" %%a in ('%qry%^|Find "0x"') do (
 set wrk=%%a
)
if "%wrk%" EQU "0x0" set OK=N&goto :EOF
if "%wrk%" EQU "0x1" set OK=Y&goto :EOF
if "%wrk%" EQU "0x2" set OK=I
Microsoft Knowledge Base Article 295659 contains the following summary:

This article describes the registry keys and values that you can use with the System Restore utility.



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