From ade08ccca048f9f09136e4d18302957b4ca3ddee Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Mon, 26 Mar 2018 12:35:40 +0200 Subject: [PATCH] Reworked DelRegKey() error messages --- cleanW10.ps1 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cleanW10.ps1 b/cleanW10.ps1 index bc5bdd3..715cc6c 100755 --- a/cleanW10.ps1 +++ b/cleanW10.ps1 @@ -217,7 +217,7 @@ function DelRegKey { ) Write-Host -NoNewline "`tDelete registery key $($params.key) : " if ( ! (Test-Path $params.path) ){ - Write-Host -ForegroundColor Red " Error path not found" + Write-Host -ForegroundColor Red " Error (path not found)" return } try { @@ -225,12 +225,11 @@ function DelRegKey { Write-host -ForegroundColor Green "done" } catch [System.Security.SecurityException]{ - Write-Host -ForegroundColor Red "Error in DelRegKey`n`t" - Write-Host -ForegoundColor DarkRed "Access to $($params.path)\$($params.key) denied" + Write-Host -ForegroundColor Red "Error (access denied)" } catch { - Write-Host -ForegroundColor Red -NoNewLine "Error in DelRegKey`n`t" - Write-Host -ForegoundColor DarkRed $Error[0].Exception.Message + Write-Host -ForegroundColor Red -NoNewLine "Error`n`t" + Write-Host -ForegroundColor DarkRed $Error[0].Exception.Message } }