‎08-15-2018 09:05 PM - last edited on ‎04-01-2024 04:42 PM by Mercedes_O
The code below gets a listing of restore points on a remote computer. I'm trying to get it to output the data in a single window. Now it's a window per line.
I'm not good with VBS so any help is appreciated.
Chris
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = WScript.Arguments(0)
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set colItems = objWMIService.ExecQuery("Select * from SystemRestore")
If colItems.Count = 0 Then
WScript.Echo "No restore point in system."
Else
For Each objItem in colItems
Wscript.Echo "Name: " & objItem.Description
Wscript.Echo "Number: " & objItem.SequenceNumber
Select Case objItem.RestorePointTypeCase 0 strRestoreType = "Application installation"
Case 1 strRestoreType = "Application uninstall"
Case 6 strRestoreType = "Restore"
Case 7 strRestoreType = "Checkpoint"
Case 10 strRestoreType = "Device drive installation"
Case 11 strRestoreType = "First run"
Case 12 strRestoreType = "Modify settings"
Case 13 strRestoreType = "Cancelled operation"
Case 14 strRestoreType = "Backup recovery"
Case Else strRestoreType = "Unknown"
End Select
Wscript.Echo "Restore Point Type: " & strRestoreType
dtmConvertedDate.Value = objItem.CreationTime
dtmCreationTime = dtmConvertedDate.GetVarDate
Wscript.Echo "Time: " & dtmCreationTime
Next
End If
‎08-20-2018 05:28 PM
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = WScript.Arguments(0)
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set colItems = objWMIService.ExecQuery("Select * from SystemRestore")
If colItems.Count = 0 Then
WScript.Echo "No restore point in system."
Else
For Each objItem in colItems
Select Case objItem.RestorePointType
Case 0 strRestoreType = "Application installation"
Case 1 strRestoreType = "Application uninstall"
Case 6 strRestoreType = "Restore"
Case 7 strRestoreType = "Checkpoint"
Case 10 strRestoreType = "Device drive installation"
Case 11 strRestoreType = "First run"
Case 12 strRestoreType = "Modify settings"
Case 13 strRestoreType = "Cancelled operation"
Case 14 strRestoreType = "Backup recovery"
Case Else strRestoreType = "Unknown"
End Select
dtmConvertedDate.Value = objItem.CreationTime
dtmCreationTime = dtmConvertedDate.GetVarDate
Wscript.Echo "Name: " & objItem.Description & vbcrlf & "Number: " & objItem.SequenceNumber & vbcrlf & "Restore Point Type: " & strRestoreType & vbcrlf & "Time: " & dtmCreationTime
Next
End If
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now