16 lines
No EOL
751 B
PowerShell
16 lines
No EOL
751 B
PowerShell
$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 |