Skip to content

Commit

Permalink
Add exception catch for Unauthorized Access (ChrisTitusTech#3114)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeveloperDurp authored Dec 28, 2024
1 parent 61c2e39 commit 28bea51
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions functions/private/Set-WinUtilRegistry.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ function Set-WinUtilRegistry {
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
} catch [System.Management.Automation.ItemNotFoundException] {
Write-Warning $psitem.Exception.ErrorRecord
} catch [System.UnauthorizedAccessException]{
Write-Warning $psitem.Exception.Message
} catch {
Write-Warning "Unable to set $Name due to unhandled exception"
Write-Warning $psitem.Exception.StackTrace
Expand Down

0 comments on commit 28bea51

Please sign in to comment.