Added restore point script
This commit is contained in:
parent
2086cab15d
commit
7520181a35
1 changed files with 16 additions and 0 deletions
16
create_restorepoint.ps1
Normal file
16
create_restorepoint.ps1
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue