Properly handle restore point creation in custom mode when using -Silent parameter and system restore is disabled

This commit is contained in:
Raphire
2025-05-05 23:46:45 +02:00
parent 09b4eb7f6b
commit 8def22ac48

View File

@@ -748,8 +748,7 @@ function CreateSystemRestorePoint {
$SysRestore = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name "RPSessionInterval"
if ($SysRestore.RPSessionInterval -eq 0) {
if (-not $Silent) {
if ($( Read-Host -Prompt "System restore is disabled, would you like to enable it and create a restore point? (y/n)") -eq 'y') {
if ($Silent -or $( Read-Host -Prompt "System restore is disabled, would you like to enable it and create a restore point? (y/n)") -eq 'y') {
try {
Enable-ComputerRestore -Drive "$env:SystemDrive"
} catch {
@@ -762,7 +761,6 @@ function CreateSystemRestorePoint {
return
}
}
}
# Find existing restore points that are less than 24 hours old
try {