From f870886df7c1fb92765620b9a2662ce4bd70f16c Mon Sep 17 00:00:00 2001 From: Conder000 Date: Fri, 1 Sep 2017 02:31:42 +0200 Subject: [PATCH] Added EnableFileDeleteConfirmation function * Added EnableFileDeleteConfirmation function * GPO equivalent: Display confirmation dialog when deleting files --- Win10.ps1 | 16 ++++++++++++++++ test/Win10-ApplyAll.preset | 1 + test/Win10-RestoreAll.preset | 1 + test/WinServer2016-ApplyAll.preset | 1 + test/WinServer2016-RestoreAll.preset | 1 + 5 files changed, 20 insertions(+) diff --git a/Win10.ps1 b/Win10.ps1 index 0688d6b..89eeeb1 100644 --- a/Win10.ps1 +++ b/Win10.ps1 @@ -54,6 +54,7 @@ $tweaks = @( "DisableStickyKeys", # "EnableStickyKeys", "ShowTaskManagerDetails" # "HideTaskManagerDetails", "ShowFileOperationsDetails", # "HideFileOperationsDetails", + "EnableFileDeleteConfirmation", # "DisableFileDeleteConfirmation", "HideTaskbarSearchBox", # "ShowTaskbarSearchBox", "HideTaskView", # "ShowTaskView", "ShowSmallTaskbarIcons", # "ShowLargeTaskbarIcons", @@ -795,6 +796,21 @@ Function HideFileOperationsDetails { Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" -Name "EnthusiastMode" -ErrorAction SilentlyContinue } +# Enable file delete confirmation dialog +Function EnableFileDeleteConfirmation { + Write-Host "Enabling file delete confirmation dialog..." + If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")) { + New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null + } + Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "ConfirmFileDelete" -Type DWord -Value 1 +} + +# Disable file delete confirmation dialog +Function DisableFileDeleteConfirmation { + Write-Host "Disabling file delete confirmation dialog..." + Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "ConfirmFileDelete" -ErrorAction SilentlyContinue +} + # Hide Taskbar Search button / box Function HideTaskbarSearchBox { Write-Host "Hiding Taskbar Search box / button..." diff --git a/test/Win10-ApplyAll.preset b/test/Win10-ApplyAll.preset index 0f432fa..0557496 100644 --- a/test/Win10-ApplyAll.preset +++ b/test/Win10-ApplyAll.preset @@ -44,6 +44,7 @@ DisableLockScreenRS1 DisableStickyKeys ShowTaskManagerDetails ShowFileOperationsDetails +EnableFileDeleteConfirmation HideTaskbarSearchBox HideTaskView ShowSmallTaskbarIcons diff --git a/test/Win10-RestoreAll.preset b/test/Win10-RestoreAll.preset index 385be2c..f41f2ce 100644 --- a/test/Win10-RestoreAll.preset +++ b/test/Win10-RestoreAll.preset @@ -44,6 +44,7 @@ EnableLockScreenRS1 EnableStickyKeys HideTaskManagerDetails HideFileOperationsDetails +DisableFileDeleteConfirmation ShowTaskbarSearchBox ShowTaskView ShowLargeTaskbarIcons diff --git a/test/WinServer2016-ApplyAll.preset b/test/WinServer2016-ApplyAll.preset index 8c0e927..de86a6d 100644 --- a/test/WinServer2016-ApplyAll.preset +++ b/test/WinServer2016-ApplyAll.preset @@ -44,6 +44,7 @@ DisableLockScreenRS1 DisableStickyKeys ShowTaskManagerDetails ShowFileOperationsDetails +EnableFileDeleteConfirmation HideTaskbarSearchBox HideTaskView ShowSmallTaskbarIcons diff --git a/test/WinServer2016-RestoreAll.preset b/test/WinServer2016-RestoreAll.preset index 58ac679..c78bf92 100644 --- a/test/WinServer2016-RestoreAll.preset +++ b/test/WinServer2016-RestoreAll.preset @@ -44,6 +44,7 @@ EnableLockScreenRS1 EnableStickyKeys HideTaskManagerDetails HideFileOperationsDetails +DisableFileDeleteConfirmation ShowTaskbarSearchBox ShowTaskView ShowLargeTaskbarIcons