From 7520181a35ace1ed3a2ca0b96abbe4b40f6d5580 Mon Sep 17 00:00:00 2001 From: Joeri Date: Fri, 20 Feb 2026 15:15:25 +0100 Subject: [PATCH] Added restore point script --- create_restorepoint.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 create_restorepoint.ps1 diff --git a/create_restorepoint.ps1 b/create_restorepoint.ps1 new file mode 100644 index 0000000..65ff30a --- /dev/null +++ b/create_restorepoint.ps1 @@ -0,0 +1,16 @@ +$RestorePointName = "QUEST-CLEANUP-$($TicketNumber -replace '[^A-Za-z0-9]', '')-$($ScriptStartTime.ToString('yyyy-MM-dd'))" + +try { + Write-Log "Creating initial restore point: $RestorePointName" + Checkpoint-Computer -Description $RestorePointName -ErrorAction Stop + $ScriptResult.restore_point_initial.created = $true + $ScriptResult.restore_point_initial.name = $RestorePointName + Write-Log "Initial restore point created successfully." +} catch { + $ErrorMsg = "Failed to create initial restore point: $($_.Exception.Message)" + $ScriptResult.restore_point_initial.error = $ErrorMsg + Write-Log $ErrorMsg -Level "ERROR" +} + +Write-Log "Initial restore point section completed." +"" | Out-File -FilePath $LogFile -Append -Encoding UTF8 \ No newline at end of file