mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2025-11-17 11:06:18 +00:00
Properly handle restore point creation in custom mode when using -Silent parameter and system restore is disabled
This commit is contained in:
@@ -748,8 +748,7 @@ function CreateSystemRestorePoint {
|
|||||||
$SysRestore = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name "RPSessionInterval"
|
$SysRestore = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name "RPSessionInterval"
|
||||||
|
|
||||||
if ($SysRestore.RPSessionInterval -eq 0) {
|
if ($SysRestore.RPSessionInterval -eq 0) {
|
||||||
if (-not $Silent) {
|
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') {
|
||||||
if ($( Read-Host -Prompt "System restore is disabled, would you like to enable it and create a restore point? (y/n)") -eq 'y') {
|
|
||||||
try {
|
try {
|
||||||
Enable-ComputerRestore -Drive "$env:SystemDrive"
|
Enable-ComputerRestore -Drive "$env:SystemDrive"
|
||||||
} catch {
|
} catch {
|
||||||
@@ -762,7 +761,6 @@ function CreateSystemRestorePoint {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# Find existing restore points that are less than 24 hours old
|
# Find existing restore points that are less than 24 hours old
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user