Reworked DelRegKey() error messages
This commit is contained in:
parent
4ba4ef330a
commit
ade08ccca0
1 changed files with 4 additions and 5 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue