Skip to content

Commit a14cf56

Browse files
committed
better error handling
1 parent 9746f47 commit a14cf56

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Modules/Get-Registry.psm1

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ function Get-Registry {
2323
}
2424
2525
.NOTES
26-
Updated: 2023-12-04
26+
Updated: 2024-04-03
2727
2828
Contributing Authors:
2929
Anthony Phipps
3030
31-
LEGAL: Copyright (C) 2023
31+
LEGAL: Copyright (C) 2024
3232
This program is free software: you can redistribute it and/or modify
3333
it under the terms of the GNU General Public License as published by
3434
the Free Software Foundation, either version 3 of the License, or
@@ -116,9 +116,8 @@ function Get-Registry {
116116
else{ # A key and value was given
117117
$value = Split-Path -Leaf $Key
118118
$Key = Split-Path -Path $Key
119-
$hasData = (Get-Item $Key -ErrorAction SilentlyContinue)
120119

121-
if ($hasData) {
120+
if (Test-Path $Key) {
122121

123122
$output = [pscustomobject] @{
124123
Key = $Key.Split(":")[2]

0 commit comments

Comments
 (0)