' Prints the list of System Restore points to a text file
' � 2005 Ramesh Srinivasan - http://windowsxp.mvps.org
' Last updated on: Aug 20, 2005
' Formats the date / time correctly

'  ----------------------------------------------------------------------------
'  -- $Id: //guest/paul_m_thompson/gd.src/vbs/List_system_restore_points.vbs#2 $
'  -- $Change: 8139 $
'  -- $DateTime: 2012/06/09 07:02:05 $
'  -- $Author: paul_m_thompson $
'  ----------------------------------------------------------------------------


Option Explicit
Dim fso, b, objWMI, clsPoint, strComputer, shell
Dim fLine, dtmInstallDate, objOS, fName
fLine = "List of System Restore points found in this computer"
Set shell = CreateObject("Wscript.Shell")
Set fso = Wscript.CreateObject("Scripting.FilesystemObject")
fName = Shell.SpecialFolders("Desktop")
fName = fName & "\ListSR.txt"
set b = fso.CreateTextFile (fName,true)
b.Writeline fLine
b.writeline string(52,"-")
b.writeblanklines 1

strComputer="."

Set dtmInstallDate = CreateObject( _
"WbemScripting.SWbemDateTime")

Set objWMI = GetObject( _
"winmgmts:\\" & strComputer & "\root\cimv2")

Set objOS = objWMI.ExecQuery( _
"Select * from Win32_OperatingSystem")

Set objWMI = getobject( _
"winmgmts:\\" & strComputer & "\root\default").InstancesOf ("systemrestore")
For Each clsPoint In objWMI
b.writeline "Creation Time= " & getmytime(clsPoint.creationtime)
b.writeline "Description= " & clsPoint.description
b.writeline "Sequence Number= " & clsPoint.sequencenumber
b.writeblanklines 1
Next

function getmytime(wmitime)
dtmInstallDate.Value = wmitime
getmytime = dtmInstallDate.GetVarDate
end function

b.close
Shell.Run "notepad.exe " & fName, 1,True
Set fso = Nothing
set shell = Nothing