diff --git a/scripts/lib/plugins.ps1 b/scripts/lib/plugins.ps1 index c32975e..63c0d55 100644 --- a/scripts/lib/plugins.ps1 +++ b/scripts/lib/plugins.ps1 @@ -57,7 +57,10 @@ function Get-InstalledPlugins { if ($Client -eq 'Claude') { return @($items) } return @($items.installed) } finally { - foreach ($name in $previousEnvironment.Keys) { [Environment]::SetEnvironmentVariable($name, $previousEnvironment[$name], 'Process') } + foreach ($name in $previousEnvironment.Keys) { + if ($null -eq $previousEnvironment[$name]) { Remove-Item -LiteralPath ("Env:" + $name) -ErrorAction SilentlyContinue } + else { [Environment]::SetEnvironmentVariable($name, $previousEnvironment[$name], 'Process') } + } } }