Merge remote-tracking branch 'origin/merge-requests/96'

This commit is contained in:
Julian Ospald 2021-06-11 20:27:47 +02:00
commit 82743dda2b
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F

View File

@ -67,7 +67,7 @@ function Add-EnvPath {
$hiveKey = $envKey = $null $hiveKey = $envKey = $null
try { try {
$hiveKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey($hive, 'Default') $hiveKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($hive, '')
$envKey = $hiveKey.OpenSubKey($keyPath, $true) $envKey = $hiveKey.OpenSubKey($keyPath, $true)
$rawPath = $envKey.GetValue('PATH', '', 'DoNotExpandEnvironmentNames') $rawPath = $envKey.GetValue('PATH', '', 'DoNotExpandEnvironmentNames')
@ -78,8 +78,8 @@ function Add-EnvPath {
} }
} }
finally { finally {
if ($envKey) { $envKey.Dispose() } if ($envKey) { $envKey.Close() }
if ($hiveKey) { $hiveKey.Dispose() } if ($hiveKey) { $hiveKey.Close() }
} }
} }
} }