Hi boyoss,
The simplest way using the existing IncludeFile is to iterate through the sequence numbers.
- replace the code in the example
PS_CreateShowDelete.pb with the following script:
Code:
IncludeFile "PS_RestorePoints.pbi"
PS_Description.s = "test_2017"
CreateRestorePoint(PS_Description)
RestorePoints.s = ListRestorePoints()
Debug RestorePoints : #DELETE_ALL = #True
If #DELETE_ALL
Define.s dwEventType
For rtnCount = 1 To CountString(RestorePoints, #LF$)
dwEventType = StringField(RestorePoints, rtnCount, #LF$)
nSearch1 = FindString(dwEventType, "BEGIN_SYSTEM")
nSearch2 = FindString(dwEventType, "END_SYSTEM")
nSearch3 = FindString(dwEventType, "BEGIN_NESTED")
nSearch4 = FindString(dwEventType, "END_NESTED")
Select #True
Case Bool(nSearch1), Bool(nSearch2), Bool(nSearch3), Bool(nSearch4)
PS_Sequence = Val(Mid(dwEventType, 50, 22))
DeleteRestorePoint(PS_Sequence)
EndSelect
Next
Else
intStart = FindString(RestorePoints, PS_Description)
If intStart
intStart + Len(PS_Description) + 1
intLength = FindString(RestorePoints, "BEGIN_SYSTEM", intStart) - intStart
PS_Sequence = Val(Mid(RestorePoints, intStart, intLength))
DeleteRestorePoint(PS_Sequence)
EndIf
EndIf
NB*: Only 1 restore point can be created every 24 hours using the PowerShell method...
See:
Checkpoint-Computer