Registry api win7 compat
This commit is contained in:
parent
d86dc9b1d7
commit
6f80dd1fcc
@ -67,7 +67,7 @@ function Add-EnvPath {
|
||||
|
||||
$hiveKey = $envKey = $null
|
||||
try {
|
||||
$hiveKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey($hive, 'Default')
|
||||
$hiveKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($hive, '')
|
||||
$envKey = $hiveKey.OpenSubKey($keyPath, $true)
|
||||
$rawPath = $envKey.GetValue('PATH', '', 'DoNotExpandEnvironmentNames')
|
||||
|
||||
@ -78,8 +78,8 @@ function Add-EnvPath {
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if ($envKey) { $envKey.Dispose() }
|
||||
if ($hiveKey) { $hiveKey.Dispose() }
|
||||
if ($envKey) { $envKey.Close() }
|
||||
if ($hiveKey) { $hiveKey.Close() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user